Using std::unordered_map as underlying container for object manager #142

Closed
opened 2020-07-14 13:37:38 +02:00 by muellerr · 1 comment
Owner

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 the std::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.

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 the `std::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.
muellerr added the
feature
label 2020-07-14 13:37:38 +02:00
Owner

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.

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.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fsfw/fsfw#142
No description provided.