go-text / typesetting

High quality text shaping in pure Go.
Other
100 stars 10 forks source link

[harfbuzz] reuse shaperOpentype instead of allocating a new one #162

Closed benoitkugler closed 5 months ago

benoitkugler commented 5 months ago

This is a memory optimization : previously, the shaper field (with type *shaperOpentype) was allocated at each harbuzz.Shape call.

Removing the pointer and simply resetting the fields instead reduces memory usage.

This is very similar to https://github.com/go-text/typesetting/pull/106

benoitkugler commented 5 months ago

I'll merge this change, since it is an internal optimization with no API change.