-
Notifications
You must be signed in to change notification settings - Fork 63
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
Optimize unit conversion by reusing cv_converters
#420
Conversation
const std::lock_guard<std::mutex> lock(converters_mutex); | ||
|
||
std::string key = in_units + "|" + out_units; //Better solution? Good enough? Bother with nested maps? |
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.
depends on what is "faster", string concat and then hash, or two hashes?
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.
Yeah, that, but I was actually thinking more about if |
is somehow a valid character in a unit definition (probably not??) and/or if we could hit string encoding issues that this operator and std::string can't handle...no idea there.
Hmm... noting that this will probably conflict with #405, which should probably be merged first. |
df06259
to
9280e40
Compare
Rebased after #405 ... please reassess! |
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.
I have not seen the use of closure used in creation of the mapped converters before, but it looks like it has test coverage.
Callgrind analysis showed a >10% of runtime spent in
get_converted_value
largely because ofut_parse
when creating unit representations. This was a known unoptimized point, but the impact was higher than expected. This PR optimizes the unit conversion pipeline.Additions
Removals
Changes
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist (automated report can be put here)
Target Environment support