summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-07-12 17:50:04 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-07-27 14:58:41 +0200
commit18113e22e92a7b8d759fd0f9c9d696ee7e97a849 (patch)
treee2bf55e84d61e4fb8a7aee4d84913e3431894679 /tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt
parentdf62fdb51c2cd8746c0fe38b5af4b575cbc2bf00 (diff)
Add a benchmark for QSharedPointer
Initial results with GCC: Even though GCC's assembly looks rather bad because of the implicit fall-back from atomics to non-atomics for single-threaded applications, libstdc++'s shared_ptr still performs twice as fast as QSharedPointer, proving that the branch predictor eats libstdc++'s is-multi-threaded-check for breakfast and the two atomic operations of a QSharedPointer copy vs. one for std::shared_ptr dominate the run-time. ********* Start testing of tst_QSharedPointer ********* Config: Using QtTest library 6.2.0, Qt 6.2.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.1.1 20210712), ubuntu 20.04 PASS : tst_QSharedPointer::initTestCase() PASS : tst_QSharedPointer::refAndDeref_null_QSP_int() RESULT : tst_QSharedPointer::refAndDeref_null_QSP_int(): 0.0000024 msecs per iteration (total: 81, iterations: 33554432) PASS : tst_QSharedPointer::refAndDeref_null_SSP_int() RESULT : tst_QSharedPointer::refAndDeref_null_SSP_int(): 0.0000024 msecs per iteration (total: 81, iterations: 33554432) PASS : tst_QSharedPointer::refAndDeref_null_BSP_int() RESULT : tst_QSharedPointer::refAndDeref_null_BSP_int(): 0.0000025 msecs per iteration (total: 87, iterations: 33554432) PASS : tst_QSharedPointer::refAndDeref_null_QSP_QString() RESULT : tst_QSharedPointer::refAndDeref_null_QSP_QString(): 0.0000025 msecs per iteration (total: 86, iterations: 33554432) PASS : tst_QSharedPointer::refAndDeref_null_SSP_QString() RESULT : tst_QSharedPointer::refAndDeref_null_SSP_QString(): 0.0000023 msecs per iteration (total: 80, iterations: 33554432) PASS : tst_QSharedPointer::refAndDeref_null_BSP_QString() RESULT : tst_QSharedPointer::refAndDeref_null_BSP_QString(): 0.0000026 msecs per iteration (total: 88, iterations: 33554432) PASS : tst_QSharedPointer::refAndDeref_nonnull_QSP_int() RESULT : tst_QSharedPointer::refAndDeref_nonnull_QSP_int(): 0.000019 msecs per iteration (total: 83, iterations: 4194304) PASS : tst_QSharedPointer::refAndDeref_nonnull_SSP_int() RESULT : tst_QSharedPointer::refAndDeref_nonnull_SSP_int(): 0.000010 msecs per iteration (total: 90, iterations: 8388608) PASS : tst_QSharedPointer::refAndDeref_nonnull_BSP_int() RESULT : tst_QSharedPointer::refAndDeref_nonnull_BSP_int(): 0.0000094 msecs per iteration (total: 79, iterations: 8388608) PASS : tst_QSharedPointer::refAndDeref_nonnull_QSP_QString() RESULT : tst_QSharedPointer::refAndDeref_nonnull_QSP_QString(): 0.000017 msecs per iteration (total: 75, iterations: 4194304) PASS : tst_QSharedPointer::refAndDeref_nonnull_SSP_QString() RESULT : tst_QSharedPointer::refAndDeref_nonnull_SSP_QString(): 0.000010 msecs per iteration (total: 90, iterations: 8388608) PASS : tst_QSharedPointer::refAndDeref_nonnull_BSP_QString() RESULT : tst_QSharedPointer::refAndDeref_nonnull_BSP_QString(): 0.0000091 msecs per iteration (total: 77, iterations: 8388608) PASS : tst_QSharedPointer::threadedRefAndDeref_null_QSP_int() RESULT : tst_QSharedPointer::threadedRefAndDeref_null_QSP_int(): 0.000016 msecs per iteration (total: 68, iterations: 4194304) PASS : tst_QSharedPointer::threadedRefAndDeref_null_SSP_int() RESULT : tst_QSharedPointer::threadedRefAndDeref_null_SSP_int(): 0.000025 msecs per iteration (total: 53, iterations: 2097152) PASS : tst_QSharedPointer::threadedRefAndDeref_null_BSP_int() RESULT : tst_QSharedPointer::threadedRefAndDeref_null_BSP_int(): 0.000027 msecs per iteration (total: 58, iterations: 2097152) PASS : tst_QSharedPointer::threadedRefAndDeref_null_QSP_QString() RESULT : tst_QSharedPointer::threadedRefAndDeref_null_QSP_QString(): 0.000016 msecs per iteration (total: 71, iterations: 4194304) PASS : tst_QSharedPointer::threadedRefAndDeref_null_SSP_QString() RESULT : tst_QSharedPointer::threadedRefAndDeref_null_SSP_QString(): 0.000027 msecs per iteration (total: 58, iterations: 2097152) PASS : tst_QSharedPointer::threadedRefAndDeref_null_BSP_QString() RESULT : tst_QSharedPointer::threadedRefAndDeref_null_BSP_QString(): 0.000017 msecs per iteration (total: 73, iterations: 4194304) PASS : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_int() RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_int(): 0.00073 msecs per iteration (total: 96, iterations: 131072) PASS : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_int() RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_int(): 0.000408 msecs per iteration (total: 107, iterations: 262144) PASS : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_int() RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_int(): 0.00033 msecs per iteration (total: 89, iterations: 262144) PASS : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_QString() RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_QString(): 0.000877 msecs per iteration (total: 115, iterations: 131072) PASS : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_QString() RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_QString(): 0.00033 msecs per iteration (total: 89, iterations: 262144) PASS : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_QString() RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_QString(): 0.000385 msecs per iteration (total: 101, iterations: 262144) PASS : tst_QSharedPointer::cleanupTestCase() Totals: 26 passed, 0 failed, 0 skipped, 0 blacklisted, 7995ms ********* Finished testing of tst_QSharedPointer ********* Change-Id: I0bed70142ffdbde6898ec0e27cb470b50fc0e97d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt')
-rw-r--r--tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt b/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt
new file mode 100644
index 0000000000..5103fc3229
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt
@@ -0,0 +1,9 @@
+qt_internal_add_benchmark(tst_bench_shared_ptr
+ SOURCES
+ tst_bench_shared_ptr.cpp
+ INCLUDE_DIRECTORIES
+ .
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Test
+)