jimp-dev / jimp-native

Make your sever-side Jimp code run 10x faster!
MIT License
26 stars 4 forks source link

Add support for `loadFont` #4

Open aardvarkk opened 1 year ago

aardvarkk commented 1 year ago

Sorry if I'm missing something, but it's my understanding that loadFont is not part of the jimp-native library. I've noticed that bitmap font loading is very slow in jimp, and it looks like even if you try to run a bunch of font loading concurrently, they all get stuck in a queue anyway and the situation doesn't improve.

I think we'd see huge gains by implementing the font loading natively (and in parallel!) and this would eliminate a huge bottleneck in terms of speed.

aardvarkk commented 1 year ago

Further profiling indicates loadFont isn't as slow as I initially thought, so please feel free to close if this issue is irrelevant or not in the plan.

sjoerd108 commented 1 year ago

I usually keep fonts around in memory and reuse them, if you have a lot of fonts that may not work though. The main bottleneck would come from reading and parsing the bitmaps themselves. I'm planning to overhaul this library so that parsing of image formats themselves are handled in C++ land, that would probably resolve the issue you're having.