-
Notifications
You must be signed in to change notification settings - Fork 108
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
Only use one SlotMap
#312
Only use one SlotMap
#312
Conversation
* Change `SlotMap` for `children` and `parents` to `SecondaryMap`
Neat. Reading the docs for SecondaryMap suggests that this is primarily a performance optimization. I think this makes sense, but have you tested out the benchmarks before and after? |
I think this is the only benefit. And I think how it works is like this:
I guess that might give a slight performance boost, as it would save the SecondarySlotMap from looking for a free slot on insert. It also means we don't have to manually remove keys from the secondary maps (only the primary one). Seems like a win, but a small one? Although measuring would of course be a good idea. |
I don’t really have much experience with benchmarking 😅 is there a easy command for that? |
There is: ‘cargo bench’. You should run it first on the main branch. Then checkout your branch and run it again (and ideally post the output of the second run here). |
Ok thanks I’ll do it later |
(i ran the new changes first, so don't be confused with the Main branch:
DasLixou's PR:
Looks like my changes actually decrease performace: i run my change again after the benchmarks of the
|
Hmm... basically looks like performance isn't affected much at all. That benchmark is only using 10 nodes and completes in microseconds so there tends to be a bit of variance on it. This is actually what I would expect. Especially as our benchmarks currently only test layout computation, and don't benchmark tree creation at all. Whereas tree creation is the only thing I would expect this to affect (if anything). |
Precisely. We should probably have dedicated benches for that. |
Going to block on #322 here, or other compelling evidence that this helps :) I think this is right, but perf changes are notoriously hard to do by gut feel. |
Cherry picking this on top of #401 confirms that this PR doesn't make much difference to perf even if we measure tree creation. So a decision on this should be made purely on the basis of code style. |
I think this is somewhat more complex; closing. |
Objective
Change
SlotMap
forchildren
andparents
toSecondaryMap
Changes that will affect external library users must update RELEASES.md before they will be merged.
Context
Maybe remove lines like
204
,205
innode.rs
, maybe they are useless now.