-
Notifications
You must be signed in to change notification settings - Fork 767
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
How about implement gtsam::KeyValueMap with hashable container? #1703
Comments
I think last time we discussed it's because we can't break API in 4.x |
KeyValueMap uses std::map in the current develop, so I'm not sure what the issue is asking for. |
@varunagrawal @ProfFan |
You can search in the issues, it's long long time ago. Actually what you can even do is just make a fork replacing Value to be a simple map, and then make a PR :) |
Feature
It seems that gtsam::KeyValueMap is implemented based on boost::ptr_map.
And boost::ptr_map is implemented based on std::map (https://www.boost.org/doc/libs/1_81_0/libs/ptr_container/doc/ptr_map.html)
std::map is implemented with red-black tree.
So the time complexity of gtsam::KeyValueMap::find is O(logN).
So, gtsam::Value::exists takes O(logN).
Motivation
I want to make gtsam::Value::exists faster.
Pitch
The time complexity of gtsam::Value::exists becomes constant time.
Alternatives
How about using std::unordered_map instead of boost::ptr_map?
The text was updated successfully, but these errors were encountered: