switch map to unordered_map
Generally, unordered_maps should be preferred over map because they have
faster access times (O(1)) and tend to allocate less dynamic memory. We
do not rely on ordered iteration in any current use of maps, so it is
safe to do a full replace.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ieaa28ac7f70f9913d13d25142fea9861d49bb23f
diff --git a/scripts/parse_led.py b/scripts/parse_led.py
index 71470c7..f03d3c0 100755
--- a/scripts/parse_led.py
+++ b/scripts/parse_led.py
@@ -44,12 +44,12 @@
ofile.write('/* !!! WARNING: This is a GENERATED Code..')
ofile.write('Please do NOT Edit !!! */\n\n')
- ofile.write('static const std::map<std::string,')
+ ofile.write('static const std::unordered_map<std::string,')
ofile.write(' std::set<phosphor::led::Layout::LedAction>>')
ofile.write(' systemLedMap = {\n\n')
for group in list(ifile.keys()):
- # This section generates an std::map of LedGroupNames to std::set
- # of LEDs containing the name and properties
+ # This section generates an std::unordered_map of LedGroupNames to
+ # std::set of LEDs containing the name and properties
led_dict = ifile[group]
ofile.write(
' {\"' +