benchmarking string to enum member name lookup; std.conv.to vs someEnum[string] AA map

Code



Application output:

immutable(char[][11]) nameArray = ["John", "Joe", "Sue", "Blargh", "Blurgh", "Foo", "Bar", "Boo", "Buh", "Snail", "Elephant"] immutable(NameEnum[string]) nameAA = ["Joe":Joe, "Blargh":Blargh, "Blurgh":Blurgh, "Buh":Buh, "Snail":Snail, "Elephant":Elephant, "Foo":Foo, "Boo":Boo, "John":John, "Sue":Sue, "Bar":Bar] std.conv.to: 0.72186 secs AA lookup: 0.19523 secs (27.04% of above, faster by a factor of 3.70x) std.conv.to: 0.72084 secs AA lookup: 0.19727 secs (27.37% of above, faster by a factor of 3.65x) std.conv.to: 0.71738 secs AA lookup: 0.19876 secs (27.71% of above, faster by a factor of 3.61x)

Paste info


Author: Zorael
Views: 616
Private: no
Expires: Never
Uploaded: 01.03.14 17:10
Votes: 0

Compilation


Compiler: DMD 2.077.1 ( 2.077.1 )
Pointer size: m64

Actions