-
Notifications
You must be signed in to change notification settings - Fork 62
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
The Initialisation Optimisation #2097
The Initialisation Optimisation #2097
Conversation
Thanks for this! A couple remarks:
|
|
|
* Split fvm_layout into multiple phases. * Run system profiler on busyring with pure initialisation workload * Conclude we spend _all_ of our time in minuscule allocations * These are caused by integrate_* > pw_zip_with > push_back.
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 refactoring! Big effort, but improves quality considerably.
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.
At a certain point it was hard to stop. I am still a bit annoyed by my inability to get rid of a bunch of useless
allocations:
pw_over_cable
integrate_area
pw_zip_with
all these allocate tons of small, intermediate vectors. Like someone with a taste for functional languages and
their use of list-as-control-structure wrote that part (@halfflat, maybe?). It's not BAD, just 10% or so, but that
whole thing (=initialize) dies a death of a million papercuts.
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.
maybe if pw_elements
wasn't a container but a range adaptor it'd be easier to get rid of those allocations, but I haven't looked closely. For now I think this is good enough.
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.
Me too, or I'd still be trying.
What?
connections_on
std::visit
w/std::get
/std::holds_alternative
. I'll the numbers do the talkingfvm_layout.cpp
:/pw_zip_with
due tointegrate
reserve
/resize
where we can.std::pmr
. GCC has it, Clang 16 will have it.Impact
Before
After
How?
See here
https://stackoverflow.com/questions/57726401/stdvariant-vs-inheritance-vs-other-ways-performance
std::visit
has horrible performance.