[poppler] [RFC] Small string optimization in GooString

Adam Reichold adam.reichold at t-online.de
Mon Jun 29 11:19:48 PDT 2015


Hello again,

trying to get more insight into the referenced changes, I added some
microbenchmarks to test the performance of the GooString implementations
in isolation using Qt's built-in benchmarking facilities (with the
Linux-Perf-based measurement system).

Attached are three graphs for construction of GooString instances with
variously sized C strings (which seems to be the most common operation
in the code base) showing CPU cycles, cache misses and branch misses
comparing the current (24/40), the compact (24/32) and adjusted (16/32)
variants normalized w.r.t. the the current version.

The result seems to be that the compact variant is between 20 and 35
percent faster than the current version for short strings and marginally
faster for long ones. However, the number of cache and branch misses
looks much more irregular (note that the branch misses are scaled
logarithmically) even though the compact variant also seems to be better
than the current version more often than not.

Insertion of C strings into GooString instances (the fourth graph) shows
a rather different behaviour with both the compact and adjusted model
being faster to insert long but sometimes slower to insert short
strings. The actual values are much closer together than for
construction, but I have to admit that I currently do not understand
this effect.

Since insertion of short strings seems more common than insertion of
long strings in the code base, this might be a net loss. Even though I'd
assume that this should still be offset by the fact that construction of
short strings seems to be even more common.

Best regards, Adam.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: goo-string-improvements-v2.patch
Type: text/x-patch
Size: 27702 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20150629/d146b044/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: goostring-measurements.tar.bz2
Type: application/x-bzip2
Size: 45032 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20150629/d146b044/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20150629/d146b044/attachment-0001.sig>


More information about the poppler mailing list