[poppler] [RFC] Small string optimization in GooString

Albert Astals Cid aacid at kde.org
Wed Jul 1 14:19:42 PDT 2015


El Dilluns, 29 de juny de 2015, a les 20:19:48, Adam Reichold va escriure:
> Hello again,

Hi there.

> 
> 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.

I welcome the interest in making stuff faster but is GooString really the 
bottleneck in any of the use cases of poppler?

Sure we can probably make it 1% faster and that's great but usually the "slow" 
stuff is somewhere else, no?

Or have you found some use case that is heavely dependant on GooString speed?

Please do not take this as a "stop doing this", i'm sure you're doing it and 
you're either learning a lot or having fun, so continue doing it and see where 
we end up :)

Cheers,
  Albert

> 
> Best regards, Adam.



More information about the poppler mailing list