我使用PHP来进行纬度/经度点以生成JS并在OSM Map上显示点.当我在录音中有10分钟或更长时间的暂停时,我想在地图上制作一首新曲目.
我的数据集目前在大约10个不同的轨道上有大约30000条记录(一些轨道有大约300个点,其他轨道有数千个).
我遇到了PHP的性能问题.当循环聚集了数百个点时,数据的处理速度很快,但如果轨道有数千个点,则性能会急剧下降.
以下是每个轨道的每个点所需的时间
+-----------------+------------------------------+
| Points On Track | Time To Proceed 10000 Points |
+-----------------+------------------------------+
| 21 | 0.75 |
| 18865 | 14.52 |
| 539 | 0.79 |
| 395 | 0.71 |
| 827 | 0.79 |
| 400 | 0.74 |
| 674 | 0.78 |
| 2060 | 1.01 |
| 2056 | 0.99 |
| 477 | 0.73 |
| 628 | 0.77 |
| 472 | 0.73 |
+-----------------+------------------------------+
Run Code Online (Sandbox Code Playgroud)
我们可以看到,当我在赛道上有很多分数时,表现会大幅下降.在这种特殊情况下,处理所有点需要大约30个秒.如果我将每个曲目的点数限制为500点,那么表现相当不错(我的数据集大约需要2.5秒). …
我正在尝试更新QProgressDialog(由QMainWindow类拥有)沿着执行一些耗时操作的QThread.线程在操作期间发出一些信号,以通知调用应用程序有关进展.我正在寻找将线程发出的进度信号连接到QProgressDialog的setValue槽以更新进度条.
它不起作用!不显示进度对话框.如果我在QMainWindow中添加一个插槽并将其连接到工作进度信号以显示线程通过qDebug输出给出的值,我看到信号似乎在线程操作期间被堆叠并且仅在结束时被取消堆叠.线.
我尝试过DirectConnection connect选项但没有成功.
这是我的代码:qapp.cpp
#include "qapp.h"
#include <threaded.h>
#include <QVBoxLayout>
#include <QPushButton>
#include <QDebug>
#include <QProgressDialog>
QApp::QApp(QWidget *parent) :
QMainWindow(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QWidget *window = new QWidget(this);
window->setLayout(mainLayout);
setCentralWidget(window);
QPushButton *button = new QPushButton("Run");
mainLayout->addWidget(button);
connect(button, SIGNAL(clicked(bool)), this, SLOT(doSomeWork()));
}
void QApp::doSomeWork()
{
qDebug() << "do some work";
Threaded worker;
worker.doHeavyCaclulations();
QProgressDialog progressDialog("Copying files...", "Abort Copy", 0, 10000, this);
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setMinimumDuration(0);
progressDialog.setValue(0);
connect(&worker, SIGNAL(progress(int)), &progressDialog, SLOT(setValue(int)));
connect(&worker, SIGNAL(progress(int)), this, SLOT(displayProgress(int)));
worker.wait();
qDebug() << "end of …Run Code Online (Sandbox Code Playgroud)