QUrl vs KURL - here's some benchmark results for you

Andreas Aardal Hanssen ahanssen at trolltech.com
Thu Jun 2 21:46:45 BST 2005


Just thought I'd add some sparks to the QUrl vs KURL debate.

Here're some results from a benchmark I've done, comparing the performance 
of constructing, parsing, copying, resolving and generating URLs with QUrl 
from Qt 3 and Qt 4 and KURL from kdelibs v3.3.0.

The benchmark was done with libkdecore from SuSE 9.2, running on an Intel 
P4 2.8GHz with 1 gig of RAM (for what it's worth). gcc 3.3.4, Qt 3.3 and 
Qt 4 were also built in release mode. For the test program and data, see 
the bottom of this mail. Btw, variance between the individual runs are 
caused by my machine being linked up to our build farm, so there's always 
compile activity going on in the background. [*]

If the results look messed up, you can find them in files in the attached 
bundle.

Results:

KDE3: Constructing 17360 KURL objects, attempt 0 21.43 seconds 810 /sec
KDE3: Constructing 17360 KURL objects, attempt 1 22.09 seconds 785 /sec
KDE3: Constructing 17360 KURL objects, attempt 2 20.92 seconds 829 /sec
KDE3: Extracting path, attempt 0 21.30 seconds 814 /sec
KDE3: Extracting path, attempt 1 21.61 seconds 803 /sec
KDE3: Extracting path, attempt 2 21.39 seconds 811 /sec
KDE3: Copying 1000000 KURL objects, attempt 0  0.55 seconds 1805054 /sec
KDE3: Copying 1000000 KURL objects, attempt 1  0.59 seconds 1703577 /sec
KDE3: Copying 1000000 KURL objects, attempt 2  0.54 seconds 1845018 /sec
KDE3: Generating 1000000 urls, then converting to string, attempt 0 32.50 seconds 30772 /sec
KDE3: Generating 1000000 urls, then converting to string, attempt 1 31.20 seconds 32056 /sec
KDE3: Generating 1000000 urls, then converting to string, attempt 2 36.28 seconds 27564 /sec
KDE3: Resolving 17360 urls against 198 links, then converting to string, attempt 0: 36.71 seconds 27237 /sec
KDE3: Resolving 17360 urls against 198 links, then converting to string, attempt 1: 36.33 seconds 27525 /sec
KDE3: Resolving 17360 urls against 198 links, then converting to string, attempt 2: 32.63 seconds 30642 /sec

Qt3: Constructing 17360 QUrl objects, attempt 0 16.18 seconds 1073 /sec
Qt3: Constructing 17360 QUrl objects, attempt 1 16.61 seconds 1044 /sec
Qt3: Constructing 17360 QUrl objects, attempt 2 18.31 seconds 948 /sec
Qt3: Extracting path, attempt 0 16.64 seconds 1042 /sec
Qt3: Extracting path, attempt 1 16.65 seconds 1042 /sec
Qt3: Extracting path, attempt 2 16.63 seconds 1043 /sec
Qt3: Copying 1000000 QUrl objects, attempt 0  0.49 seconds 2036659 /sec
Qt3: Copying 1000000 QUrl objects, attempt 1  0.51 seconds 1949317 /sec
Qt3: Copying 1000000 QUrl objects, attempt 2  0.53 seconds 1886792 /sec
Qt3: Generating 1000000 urls, then converting to string, attempt 0 18.26 seconds 54767 /sec
Qt3: Generating 1000000 urls, then converting to string, attempt 1 18.16 seconds 55075 /sec
Qt3: Generating 1000000 urls, then converting to string, attempt 2 18.38 seconds 54398 /sec
Qt3: Resolving 17360 urls against 198 links, then converting to string, attempt 0: 18.27 seconds 54725 /sec
Qt3: Resolving 17360 urls against 198 links, then converting to string, attempt 1: 18.14 seconds 55111 /sec
Qt3: Resolving 17360 urls against 198 links, then converting to string, attempt 2: 20.64 seconds 48454 /sec

Qt4: Constructing 17360 QUrl objects, attempt 0  0.06 seconds 275555 /sec
Qt4: Constructing 17360 QUrl objects, attempt 1  0.07 seconds 259104 /sec
Qt4: Constructing 17360 QUrl objects, attempt 2  0.06 seconds 271250 /sec
Qt4: Extracting path, attempt 0  0.30 seconds 57105 /sec
Qt4: Extracting path, attempt 1  0.26 seconds 67286 /sec
Qt4: Extracting path, attempt 2  0.27 seconds 63589 /sec
Qt4: Copying 1000000 QUrl objects, attempt 0  0.29 seconds 3496503 /sec
Qt4: Copying 1000000 QUrl objects, attempt 1  0.29 seconds 3448275 /sec
Qt4: Copying 1000000 QUrl objects, attempt 2  0.32 seconds 3134796 /sec
Qt4: Generating 1000000 urls, then converting to string, attempt 0 19.63 seconds 50934 /sec
Qt4: Generating 1000000 urls, then converting to string, attempt 1 20.03 seconds 49932 /sec
Qt4: Generating 1000000 urls, then converting to string, attempt 2 17.78 seconds 56239 /sec
Qt4: Resolving 17360 urls against 198 links, then converting to string, attempt 0: 16.95 seconds 58986 /sec
Qt4: Resolving 17360 urls against 198 links, then converting to string, attempt 1: 16.20 seconds 61716 /sec
Qt4: Resolving 17360 urls against 198 links, then converting to string, attempt 2: 16.20 seconds 61724 /sec

Um.. Qt 4's URL parser seems to be 78x faster than KURL's parser. ;-)

Test data and code:

http://www.andreas.hanssen.name/qurl-kurl-benchmark.tar.bz2

Andreas :-)

[*] To preempt those who like to kill benchmarks like this, the undeniable 
    truth and point of this test is that QUrl in Qt 4 is pretty fast 
    compared to KURL.

-- 
Andreas Aardal Hanssen - andreas . hanssen @ trolltech.com
Trolltech AS - Waldemar Thranes gt. 98, NO-0175 Oslo, Norway




More information about the kde-core-devel mailing list