path: root/frup.hpp
diff options
authorPatrick Williams <>2017-06-01 19:19:09 -0500
committerPatrick Williams <>2017-06-02 15:13:46 +0000
commita71d0f15a3e2584a4f83f7cc6d9c9bbec99ea4f7 (patch)
tree72879445c57ed922fa203acd0d6913743d572b64 /frup.hpp
parentaeb726df2fb7e0a3510242337c79994592ed1523 (diff)
fru_gen: eliminate unnecessary maps
The type of the generated fru data contained a map of a map of a map of a map, but for all except the outermost map, all elements were iterated over when using the map. Therefore, change them to a vector<pair<...>> instead. Vector should generate smaller code and allow faster iteration. Vector insert and iteration are both linear where as map is O(n lg n). Change-Id: I475e5a40b4051e4ce9478a565c889c1751241987 Signed-off-by: Patrick Williams <>
Diffstat (limited to 'frup.hpp')
1 files changed, 5 insertions, 4 deletions
diff --git a/frup.hpp b/frup.hpp
index 09ffc9f..15b5eaf 100644
--- a/frup.hpp
+++ b/frup.hpp
@@ -5,6 +5,7 @@
#include <array>
#include <string>
#include <map>
+#include <vector>
enum ipmi_fru_area_type
@@ -83,16 +84,16 @@ struct IPMIFruData
using DbusProperty = std::string;
-using DbusPropertyMap = std::map<DbusProperty,IPMIFruData>;
+using DbusPropertyVec = std::vector<std::pair<DbusProperty,IPMIFruData>>;
using DbusInterface = std::string;
-using DbusInterfaceMap = std::map<DbusInterface,DbusPropertyMap>;
+using DbusInterfaceVec = std::vector<std::pair<DbusInterface,DbusPropertyVec>>;
using FruInstancePath = std::string;
-using FruInstanceMap = std::map<FruInstancePath,DbusInterfaceMap>;
+using FruInstanceVec = std::vector<std::pair<FruInstancePath,DbusInterfaceVec>>;
using FruId = uint32_t;
-using FruMap = std::map<FruId,FruInstanceMap>;
+using FruMap = std::map<FruId,FruInstanceVec>;
/* Parse an IPMI write fru data message into a dictionary containing name value pair of VPD entries.*/
int parse_fru (const void* msgbuf, sd_bus_message* vpdtbl);
OpenPOWER on IntegriCloud