-
Notifications
You must be signed in to change notification settings - Fork 12
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
[opentype/gpos] use plain struct instead of pointer #117
Conversation
@benoitkugler Do you have before/after benchmark info you could share? |
Here you are : the code simply runs Shaper.Shape, with a font using a GPOS table (Arimo). Code
Benchmark stats
Memory profile - Before:Memory profile - After : |
Has the "After" trimmed the RunN contribution or did that go to 0? |
I'm able to replicate the benchmark improvements:
Even if this is just shifting an allocation to the caller's stack, the result is that memory is getting re-allocated fewer times during the shaping process, so it's still a net win. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification :)
During some benchmarks, I found
tables.PairSet.FindGlyph
was a really high source of heap allocations.Using a plain struct (probably) allows the compiler/runtime to allocate it on the stack, resulting in a sizable reduction of heap allocations.