Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Performance issue with FontImage() #474
runs in a couple of seconds for a font with 256 glyphs, but takes upwards of half an hour for a font with about 3000 glyphs. The time per glyph seems to be proportional to the number of glyphs, making the script's running time quadratic overall where it seems it should be linear.
The code behind FontImage() isn't very clear, but it looks to me like it is generating an entire bitmap strike for the entire font on each line of output, and then discarding it immediately. That seems suboptimal. It would be better to cache the generated bitmaps, only generate the bitmaps needed for the glyphs actually requested, or both.
A possible workaround, which I haven't finished testing yet, may be to manually request generation of a bitmap strike before the start of the loop. Even if that helps my own case, however, it would be better that FontImage() work more efficiently.