-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
Optimization for layout_init() #6547
Conversation
Initially this looks good for ads protos, just gathering some data on our large data set now! |
I'm getting the following crash on Mac Ruby 2.3. I've reproduced this locally:
The fact that this is in layout_mark() makes me worry that the crash might already be on master. |
I did some testing and I have been unable to reproduce this on master, but it reproduces relatively easily on this branch. So it appears the bug is in this PR after all (which is good -- I can fix it before merging). |
The crash that I was seeing earlier has been fixed in the latest commit. This is ready for review. |
This avoids most of the work of layout_init() by creating a template object we can
memcpy()
from when initializing a new object.There is a bit of complication since we must eagerly allocate maps and repeated fields. So we have to
dup
these still inlayout_init()
.In the benchmark on my machine this takes us from 8 seconds to 2.3 seconds, or a 70% reduction in runtime overall.