Inner workings of yaml-cpp vs c++ maps -
just quick question inner workings of yaml-cpp.
i noticed when tried key didn't exist got error such as:
yaml-cpp: error @ line 0, column 0: bad conversion
i suprised because have assumed point post loading operating directly off in memory map
if lookup such as
string foo = myyaml["bar"]["foo"].as<string>();
does happen efficiently if had typed map. more efficient if preprocess things know exist in yaml c++ map , access them directly rather via node?
i guess i'm asking if perf of map faster acessing node
thanks
lookup in map in yaml-cpp o(n)
- loops through entries in map. see this issue on project page.
lookup in std::map
o(log n)
- stores keys in order, , binary searches find key. if have large number of keys, might faster preprocess data. should measure first :)
Comments
Post a Comment