mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
improved speedtest example (context-menu now allows to select the different options) and updated performance table for a newer processor
This commit is contained in:
parent
307f477626
commit
39c43ef8ab
@ -65,7 +65,7 @@ There are different facor affecting the replot speed:
|
||||
3. *Axis Scales and Plot Appearance:* Replotting is done in two steps: First the plot with the axes, labels etc. is drawn. Then the graphs are draw on top. Therefore a replot is faster, if only the graphs change, because the background (plot) does not have to be replotted.
|
||||
|
||||
|
||||
the next table summarizes some results for plotting speed under different conditions, obatined with the test program in this directory (conditions: Qt 5.11, 32-bit, MinGW, Release, Phenom II X4 765, 500 data points):
|
||||
The next table summarizes some results for plotting speed under different conditions, obatined with the test program in this directory (conditions: Qt 5.11, 32-bit, MinGW, Release, Win7, Phenom II X4 765, 500 data points):
|
||||
|
||||
| Anti-Aliasing | X-Axis Redraw | # Graphs | frame rate [fps] |
|
||||
| ---------------- | --------------- | ------------- | ---------------- |
|
||||
@ -80,3 +80,18 @@ the next table summarizes some results for plotting speed under different condit
|
||||
|
||||
|
||||
|
||||
Rerunning this test on a modern AMD Ryzen 3600 (conditions: Qt 5.13.1, 64-bit, MinGW, Release, AMD Ryzen 3600, Win10, 500 data points):
|
||||
|
||||
| Anti-Aliasing | X-Axis Redraw | # Graphs | frame rate [fps] |
|
||||
| ---------------- | --------------- | ------------- | ---------------- |
|
||||
| yes | yes | 2 | 7 |
|
||||
| yes | yes | 1 | 14 |
|
||||
| yes | no | 2 | 14 |
|
||||
| yes | no | 1 | 28 |
|
||||
| no | yes | 2 | 30 |
|
||||
| no | yes | 1 | 52 |
|
||||
| no | no | 2 | 59 |
|
||||
| no | no | 1 | 100 |
|
||||
|
||||
|
||||
|
||||
|
@ -54,6 +54,30 @@ SpeedTestPlot::SpeedTestPlot():
|
||||
setX(X[0], X[NDATA-1]);
|
||||
setY(-2,2);
|
||||
|
||||
actAntiAliase=new QAction("Anti-Aliase");
|
||||
actAntiAliase->setCheckable(true);
|
||||
actAntiAliase->setChecked(false);
|
||||
connect(actAntiAliase, &QAction::triggered, std::bind([](SpeedTestPlot* p){
|
||||
p->getPlotter()->setUseAntiAliasingForGraphs(p->actAntiAliase->isChecked());
|
||||
p->getPlotter()->setUseAntiAliasingForSystem(p->actAntiAliase->isChecked());
|
||||
p->getPlotter()->setUseAntiAliasingForText(p->actAntiAliase->isChecked());
|
||||
}, this));
|
||||
|
||||
actTwoGraphs=new QAction("2 Graphs");
|
||||
actTwoGraphs->setCheckable(true);
|
||||
actTwoGraphs->setChecked(true);
|
||||
connect(actTwoGraphs, &QAction::triggered, std::bind([](SpeedTestPlot* p, JKQTPXYLineGraph* g){
|
||||
g->setVisible(p->actTwoGraphs->isChecked());
|
||||
}, this, graph2));
|
||||
|
||||
actFixedXAxis=new QAction("Fixed X-Axis");
|
||||
actFixedXAxis->setCheckable(true);
|
||||
actFixedXAxis->setChecked(false);
|
||||
|
||||
addAction(actAntiAliase);
|
||||
addAction(actTwoGraphs);
|
||||
addAction(actFixedXAxis);
|
||||
|
||||
// show plotter and make it a decent size
|
||||
show();
|
||||
resize(1000,500);
|
||||
@ -66,28 +90,29 @@ SpeedTestPlot::~SpeedTestPlot()
|
||||
|
||||
void SpeedTestPlot::plotNewData()
|
||||
{
|
||||
// move old data to the left
|
||||
for (size_t i=0; i<NDATA-1; i++) {
|
||||
X[i]=X[i+1];
|
||||
Y[i]=Y[i+1];
|
||||
Y2[i]=Y2[i+1];
|
||||
}
|
||||
// add one new data point
|
||||
X[NDATA-1]=X[NDATA-2]+dx;
|
||||
Y[NDATA-1]=sin(X[NDATA-1])+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
Y2[NDATA-1]=cos(X[NDATA-1])+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
if (actFixedXAxis->isChecked()) {
|
||||
// ALTERNATIVE: MOVE data, but keep x-axis range
|
||||
x0+=dx;
|
||||
for (size_t i=0; i<NDATA-1; i++) {
|
||||
Y[i]=Y[i+1];
|
||||
Y2[i]=Y2[i+1];
|
||||
}
|
||||
// add one new data point
|
||||
Y[NDATA-1]=sin(X[NDATA-1]+x0)+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
Y2[NDATA-1]=cos(X[NDATA-1]+x0)+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
} else {
|
||||
// move old data to the left
|
||||
for (size_t i=0; i<NDATA-1; i++) {
|
||||
X[i]=X[i+1];
|
||||
Y[i]=Y[i+1];
|
||||
Y2[i]=Y2[i+1];
|
||||
}
|
||||
// add one new data point
|
||||
X[NDATA-1]=X[NDATA-2]+dx;
|
||||
Y[NDATA-1]=sin(X[NDATA-1])+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
Y2[NDATA-1]=cos(X[NDATA-1])+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
|
||||
/*
|
||||
// ALTERNATIVE: MOVE data, but keep x-axis range
|
||||
x0+=dx;
|
||||
for (size_t i=0; i<NDATA-1; i++) {
|
||||
Y[i]=Y[i+1];
|
||||
Y2[i]=Y2[i+1];
|
||||
}
|
||||
// add one new data point
|
||||
Y[NDATA-1]=sin(X[NDATA-1]+x0)+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
Y2[NDATA-1]=cos(X[NDATA-1]+x0)+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||
*/
|
||||
|
||||
|
||||
// set new x-range and replot
|
||||
|
@ -15,10 +15,14 @@ class SpeedTestPlot: public JKQTPlotter {
|
||||
const double dx;
|
||||
double x0;
|
||||
std::chrono::system_clock::time_point t_lastplot;
|
||||
QAction* actAntiAliase;
|
||||
QAction* actTwoGraphs;
|
||||
QAction* actFixedXAxis;
|
||||
public:
|
||||
SpeedTestPlot();
|
||||
|
||||
virtual ~SpeedTestPlot();
|
||||
public slots:
|
||||
void plotNewData();
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user