qt 6.5.1 original

This commit is contained in:
kleuter
2023-10-29 23:33:08 +01:00
parent 71d22ab6b0
commit 85d238dfda
21202 changed files with 5499099 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtjson Binary:
#####################################################################
qt_internal_add_benchmark(tst_bench_qtjson
SOURCES
tst_bench_qtjson.cpp
LIBRARIES
Qt::Test
)

View File

@ -0,0 +1,19 @@
[
{
"integer": 1234567890,
"real": -9876.543210,
"e": 0.123456789e-12,
"E": 1.234567890E+34,
"": 23456789012E66,
"zero": 0,
"one": 1
},
[
-1234567890,
-1234567890,
-1234567890,
1234567890,
1234567890,
1234567890
]
]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,122 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QVariantMap>
#include <qjsondocument.h>
#include <qjsonobject.h>
class BenchmarkQtJson: public QObject
{
Q_OBJECT
public:
BenchmarkQtJson(QObject *parent = nullptr);
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void parseNumbers();
void parseJson();
void parseJsonToVariant();
void jsonObjectInsert();
void variantMapInsert();
};
BenchmarkQtJson::BenchmarkQtJson(QObject *parent) : QObject(parent)
{
}
void BenchmarkQtJson::initTestCase()
{
}
void BenchmarkQtJson::cleanupTestCase()
{
}
void BenchmarkQtJson::init()
{
}
void BenchmarkQtJson::cleanup()
{
}
void BenchmarkQtJson::parseNumbers()
{
QString testFile = QFINDTESTDATA("numbers.json");
QVERIFY2(!testFile.isEmpty(), "cannot find test file numbers.json!");
QFile file(testFile);
file.open(QFile::ReadOnly);
QByteArray testJson = file.readAll();
QBENCHMARK {
QJsonDocument doc = QJsonDocument::fromJson(testJson);
QJsonObject object = doc.object();
}
}
void BenchmarkQtJson::parseJson()
{
QString testFile = QFINDTESTDATA("test.json");
QVERIFY2(!testFile.isEmpty(), "cannot find test file test.json!");
QFile file(testFile);
file.open(QFile::ReadOnly);
QByteArray testJson = file.readAll();
QBENCHMARK {
QJsonDocument doc = QJsonDocument::fromJson(testJson);
QJsonObject object = doc.object();
}
}
void BenchmarkQtJson::parseJsonToVariant()
{
QString testFile = QFINDTESTDATA("test.json");
QVERIFY2(!testFile.isEmpty(), "cannot find test file test.json!");
QFile file(testFile);
file.open(QFile::ReadOnly);
QByteArray testJson = file.readAll();
QBENCHMARK {
QJsonDocument doc = QJsonDocument::fromJson(testJson);
QVariant v = doc.toVariant();
}
}
void BenchmarkQtJson::jsonObjectInsert()
{
QJsonObject object;
QString test(QStringLiteral("testString"));
QJsonValue value(1.5);
QBENCHMARK {
for (int i = 0; i < 1000; i++)
object.insert("testkey_" + QString::number(i), value);
}
}
void BenchmarkQtJson::variantMapInsert()
{
QVariantMap object;
QString test(QStringLiteral("testString"));
QVariant variantValue(1.5);
QBENCHMARK {
for (int i = 0; i < 1000; i++)
object.insert("testkey_" + QString::number(i), variantValue);
}
}
QTEST_MAIN(BenchmarkQtJson)
#include "tst_bench_qtjson.moc"