ahmadsamir added a comment.
In D26366#588416 <https://phabricator.kde.org/D26366#588416>, @dfaure wrote: > Benchmarking is complex ;) > > 1. you need to make sure both Qt and your benchmark are built with optimizations enabled (-O2) > 2. you need to actually use those 3 variables otherwise the compiler might optimize out their use. This could be testing their value (NOT with Q_ASSERT if you're in release mode!) and aborting if they don't have the expected value. They will, of course, but the compiler won't know that. > > Your current results indicate "54 times slower" ! But indeed on very small numbers... Qt was built with -O2, Tumbleweed default. But my ki18n build was with -O0, changed to -O2 for this test. Added QCOMPARE() calls for all 3 vars: RESULT : KLocalizedStringTest::benchmarkRegexSimple(): 0.0000098 msecs per iteration (total: 83, iterations: 8388608) PASS : KLocalizedStringTest::benchmarkRegex2() RESULT : KLocalizedStringTest::benchmarkRegex2(): 0.00054 msecs per iteration (total: 72, iterations: 131072) REPOSITORY R249 KI18n REVISION DETAIL https://phabricator.kde.org/D26366 To: ahmadsamir, #frameworks, ilic, dfaure, mlaurent, aacid Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns