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 <patrick@stwcx.xyz>
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 @@
};
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);