Using std::unordered_map as underlying container for object manager #142
Labels
No Label
API Change
Breaking API Change
bug
build
cosmetics
Documentation
duplicate
feature
help wanted
hotfix
invalid
question
Refactor
Tests
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: fsfw/fsfw#142
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The object manager is an excellent tool to share software components.
I think it would be nice to access shared data sets for the new distributed data pools (I think raw access is nice and should be implemented for data sets as well) by registering them as system objects. Because that could lead to a higher number of system objects, I propose following change:
The underlying container of the ObjectManager should be a
std:unordered_map
. Contrary to thestd::map
which is currently used, the unordered map uses a hashtable as the underlying container instead of a binary red-black tree. Therefore, it has lookup with constant complexity (O(1) instead of the already nice O(log n) of std::map). It uses more memory than the standard map, but I think that is ok. If this is a concern, I would suggest to select the underlying container as a ctor argument when initializing the object manager. What do you think? The map is intialized at software initialization, so the faster insertion operations of std::map are not needed.
I don't think we have enough objects to cause a performance impact. The map is not expected to have more than order of 100 objects. Therefore, I see this as premature optimization.