AuburnSounds / printed

Generate PDF/SVG/HTML with D, with a Canvas-style API. Now with a flow document emitter.
36 stars 7 forks source link

Cache fonts to speed up font lookup #33

Closed a-ludi closed 3 years ago

a-ludi commented 3 years ago

The method findBestMatchingFont is pretty slow which impairs performance a lot if one is producing many separate texts. This can be easily remedied by putting the result in a dictionary for caching.

p0nce commented 3 years ago

OK sounds alright indeed, but please use a static struct instead of a Tuple. Tuple rarely brings any value whatsoever... also the less phobos we use, the better the build times.

a-ludi commented 3 years ago

Good. I thought the struct might not be hashable but it seems to work just fine.

p0nce commented 3 years ago

It's in v1.0.5