-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Prepare benchmarks + ~1.7x prepare perf improvement #121
Conversation
Thanks! This looks great to me. Could you include a reference for the samples and ensure they're licensed in a way that we can include them here? Otherwise we could create our own sample. |
bf11fb8
to
7c966ea
Compare
Thanks @grovesNL for the speedy attention 🙏 .
Yes, definitely - thank you for the good suggestion and catch. I've updated the sources in 093eed7 and attributed them in |
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.
Great, thank you!
Intent
I am considering using this library for rendering on low tier devices. In evaluating the library, I discovered that there is a significant amount of time spent in CPU maintaining the 2 LRUs and Hash Sets during the prepare (roughly 40-50% of the time in spent in CPU for an example application I used):
I'm taking a look to find any low hanging fruit that could improve
prepare
time. I think the first step is to add in some benchmarks. I've added 4:The benchmarks can be run with
cargo bench
:Low Hanging Fruit
~1.7x faster => Skipping unnecessary peeks - 717474f
I noticed that when preparing a glyph, we check both LRUs if it contains the glyph, if it does, we promote them. Then, outside of the block, we peek into both LRUs trying to find the glyph (with an associated
.unwrap
).We can both
promote
andget
the glyph using[lru].get(...)
. This enables us to:atlas.glyph
when we know what LRU to lookup