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
[varStore] Improve optimize algorithm #3124
Conversation
This was always supposed to be how it works, but was missed in the initial implementation apparently.
Saves 408 bytes building NotoSansArabic. |
hm in the absence of a test that touches those lines, it's a bit too hard for me to reivew so I'll pass. feel free to merge, this is your code |
Adding Jany and Nikolaus in case one of them wants to read and understand the algorithm. I'm willing to add more comments. And yes I'll think about adding tests. |
Previously we were disregarding the best_gain. Ouch!
I documented the algorithm. |
990cb76
to
cdcbf64
Compare
The doc comment is most appreciated. +1 to tests.
Are there cases where it saves more? |
In NotoSans it saved 2kb, but that's 0.1%. I don't expect it to be much; in the 1kb to 2kb range, but hey, it's free savings. |
Doesn't hit all branches yet.
Another bugfix (thanks to new tests), and it saves 4.5kb now. |
4dc789c
to
0677c0e
Compare
Previously we were not accounting for the LOffset to VarData.
Now at 936 bytes after a few other fixes. |
This was always supposed to be how it works, but was missed in the initial implementation apparently.
I should probably add extensive tests for the optimization algorithm...