clean up timing functions
This commit is contained in:
parent
23d790cc4a
commit
f4e7eb3e49
4 changed files with 1 additions and 31692 deletions
31571
include/lib/simdjson.h
31571
include/lib/simdjson.h
File diff suppressed because it is too large
Load diff
|
@ -390,14 +390,6 @@ private:
|
|||
QObjectList shortcutableObjects() const;
|
||||
void addCustomHeaderValue(QString key, QJsonValue value, bool isNew = false);
|
||||
int insertTilesetLabel(QStringList * list, QString label);
|
||||
|
||||
// TODO: remove
|
||||
void runSpeedTest();
|
||||
struct SpeedTestStruct {
|
||||
qint64 openProject;
|
||||
qint64 setMap;
|
||||
qint64 saveAll;
|
||||
};
|
||||
};
|
||||
|
||||
enum MapListUserRoles {
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
int numRows = 0;
|
||||
int numCols = 0;
|
||||
|
||||
QList<int> slotRatios;
|
||||
QVector<int> slotRatios;
|
||||
QList<QString> groupNames;
|
||||
QList<double> slotPercentages;
|
||||
|
||||
|
|
|
@ -119,9 +119,6 @@ void MainWindow::initShortcuts() {
|
|||
shortcutsConfig.load();
|
||||
shortcutsConfig.setDefaultShortcuts(shortcutableObjects());
|
||||
applyUserShortcuts();
|
||||
|
||||
// TODO: remove
|
||||
auto *s = new QShortcut(QKeySequence("Ctrl+R"), this, [this](){runSpeedTest();});
|
||||
}
|
||||
|
||||
void MainWindow::initExtraShortcuts() {
|
||||
|
@ -2873,112 +2870,3 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
#include <QElapsedTimer>
|
||||
/*void MainWindow::runSpeedTest() {
|
||||
// 10 iterations of this function:
|
||||
// 1 - load project
|
||||
// 2 - switch map
|
||||
// 3 - save all
|
||||
|
||||
if (!editor || !editor->project) return;
|
||||
|
||||
const int runs = 10;
|
||||
QElapsedTimer timer;
|
||||
|
||||
QList<struct SpeedTestStruct> times;
|
||||
|
||||
timer.start();
|
||||
for (int i = 0; i < runs; i++) {
|
||||
struct SpeedTestStruct benchmarks;
|
||||
setMap("SlateportCity"); // reset map
|
||||
timer.restart();
|
||||
|
||||
// 1 - load project
|
||||
openProject(editor->project->root);
|
||||
benchmarks.openProject = timer.restart();
|
||||
|
||||
// 2 - switch maps
|
||||
setMap("LilycoveCity");
|
||||
benchmarks.setMap = timer.restart();
|
||||
|
||||
// 3 - save all
|
||||
editor->saveProject();
|
||||
benchmarks.saveAll = timer.restart();
|
||||
|
||||
// add time to list
|
||||
times.append(benchmarks);
|
||||
}
|
||||
|
||||
// summary
|
||||
qint64 min = std::numeric_limits<qint64>::max(), max = 0, avg = 0;
|
||||
QString summary = QString("RUN LOAD SWAP SAVE TOT \n");
|
||||
for (int i = 0; i < runs; i++) {
|
||||
summary += QString::number(i+1).leftJustified(6, ' ');
|
||||
qint64 open = times[i].openProject;
|
||||
summary += QString::number(open).leftJustified(6, ' ');
|
||||
qint64 swap = times[i].setMap;
|
||||
summary += QString::number(swap).leftJustified(6, ' ');
|
||||
qint64 save = times[i].saveAll;
|
||||
summary += QString::number(save).leftJustified(6, ' ');
|
||||
qint64 tot = open + swap + save;
|
||||
summary += QString::number(tot).leftJustified(6, ' ');
|
||||
summary += "\n";
|
||||
|
||||
if (tot < min) min = tot;
|
||||
if (tot > max) max = tot;
|
||||
avg += tot;
|
||||
}
|
||||
avg /= runs;
|
||||
|
||||
summary += "MIN: " + QString::number(min).leftJustified(6, ' ') + "MAX: " + QString::number(max).leftJustified(6, ' ') + "AVG: " + QString::number(avg) + "\n";
|
||||
|
||||
qDebug() << qUtf8Printable(summary);
|
||||
}*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
//#include <cstdlib>
|
||||
void MainWindow::runSpeedTest() {
|
||||
//
|
||||
QList<qint64> times;
|
||||
|
||||
// groupedMapNames
|
||||
QElapsedTimer timer;
|
||||
|
||||
//qDebug() << editor->project->groupedMapNames.first();
|
||||
|
||||
QStringList group0 = editor->project->groupedMapNames.first();
|
||||
|
||||
QString firstMap = group0.first();
|
||||
setMap(firstMap);
|
||||
|
||||
//std::srand(unsigned(std::time(0)));
|
||||
std::shuffle(group0.begin(), group0.end(), std::default_random_engine(69420));
|
||||
|
||||
timer.start();
|
||||
for (QString mapName : group0) {
|
||||
setMap(mapName);
|
||||
times.append(timer.restart());
|
||||
}
|
||||
|
||||
setMap(firstMap);
|
||||
|
||||
qint64 min = std::numeric_limits<qint64>::max();
|
||||
qint64 max = 0;
|
||||
qint64 average = 0;
|
||||
qint64 count = 0;
|
||||
|
||||
for (qint64 val : times) {
|
||||
if (val > max) max = val;
|
||||
if (val < min) min = val;
|
||||
average += val;
|
||||
count++;
|
||||
qDebug() << val;
|
||||
}
|
||||
|
||||
average /= count;
|
||||
|
||||
qDebug() << "*** TIMING SUMMARY ***";
|
||||
qDebug().nospace() << "min: " << min << " " << "max: " << max << " " << "avg: " << average;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue