str.to!Enum performance
realhet
real_het at hotmail.com
Mon Sep 7 15:22:12 UTC 2026
Hi,
I've compared 2 ways of converting enum identifier strings to
enum value:
- implemented with a manual associative array: 45ms
- implemented by std.conv.to: `name.to!Enum()`: 1299ms
(batch= 500_000, I tested with looking up the Segoe MDL2 Asset
symbol characters)
Anyone can tell me how std.to() is doing the conversion, is it
using the simplest way: linear search?
Can anyone point it out in the sources?
I have no luck finding it in std.conv, it's quite big. I've only
found the opposite way.
Thanks in advance.
More information about the Digitalmars-d-learn
mailing list