Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collectgarbage called unnecessarily in glyph_stream_provider callback #297

Open
vlasakm opened this issue Jan 21, 2025 · 1 comment
Open

Comments

@vlasakm
Copy link
Contributor

vlasakm commented Jan 21, 2025

More of a question at first: Is there a reason for collectgarbage (Lua full garbage collection) to be run from the harf variant of the glyph_stream_provider callback?

I would think there's no need to perform explicit GC, and especially when run for multiple fonts back-to-back it can actually be quite slow.

Depending on whether the GC is needed for mode=harf code path, I propose to either:

  1. Delete the collectgarbage call.
  2. Do collectgarbage only in case the font was loaded with mode=harf.

I can provide pull request if needed, but feel free not to wait for me with such a trivial change :)

@vlasakm
Copy link
Contributor Author

vlasakm commented Jan 21, 2025

Oops, hit the button by accident before linking all the interesting context! :)

I found the GC to be the source of performance difference between luatex and luahbtex (both not using mode=harf), which was reported by @olsak:

https://tex.stackexchange.com/questions/735071/mysterious-delay-when-downloading-fonts-difference-between-luatex-luahbtex/735470#735470

I also wonder, why is the glyph_stream_provider callback seemingly only called with the TTF font? I probably got lost in all the undocumented magic constants. In any case thank you for figuring all the magic out and implementing the great HarfBuzz support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant