[HarfBuzz] Avoiding python attribute lookups on .cluster, .codepoint, .x_advance, .x_offset, etc

Kelvin Ma kelvinsthirteen at gmail.com
Mon Aug 1 18:25:56 UTC 2016


So long ago I posted issue 287
<https://github.com/behdad/harfbuzz/issues/287> on the harfbuzz issue
tracker and I got no response, but the problem remains, using harfbuzz with
python is inordinately slow. My application only performs smoothly when run
on high-end hardware, otherwise performance is borderline-to-sluggish.

I’ve already found the bottleneck in the code, the four attribute lookups
in the unpacking function

((N.cluster, N.codepoint, P.x_advance, P.x_offset) for N, P in
zip(infos, positions))

.
Preferably this would get bypassed in the C–Python bindings, so that
the lookup would occur in C, where it would be much, much faster than
Python’s dynamic lookup. But if this isn’t going to happen any time
soon, what would be the best way to add some C helper functions in my
app to get these lookups out of the way?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160801/28313b83/attachment.html>


More information about the HarfBuzz mailing list