Closed alsotang closed 3 months ago
Hmm, yeah, there's mainly "glue code" in here, so I think we'd be tracking the performance of harfbuzzjs more than anything.
All the wasm gymnastics consists of sync operations (which is why I added the p-limit
for predictability), but maybe we can use web workers to parallelize. We might even use this trick to share the heap: https://stackoverflow.com/questions/59818702/can-you-share-webassembly-memory-between-web-workers
For more specific use cases where you create subsets of the same font over and over again you could also add the original TTF to the heap only once -- but supporting that would lead to a more complex api.
According to my current opinion, the memory optimization will not have a significant impact on the performance of this library, and may at most improve a 20% in some scenarios. So it's better to keep it simple.
But seems there is no space to improve. I try to do some memory copy related optimize but nothing changed