str.to!Enum performance
Nick Treleaven
nick at geany.org
Wed Sep 9 09:40:33 UTC 2026
On Monday, 7 September 2026 at 16:01:25 UTC, realhet wrote:
> On Monday, 7 September 2026 at 15:24:52 UTC, Richard (Rikki)
> Andrew Cattermole wrote:
>> https://github.com/dlang/phobos/blob/master/std/conv.d#L1103
>>
>> Appears to be it.
>
> Thank You!
>
> So it is a switch() of string cases.
Only when `EnumMembers!S.length <= 50`. Maybe you could benchmark
<= 50 members vs your AA?
> And that particular implementation is not allowed to do fancy,
> resource-involving stuff like an associative array. I will
> remember this. And also I will remember that with integer
> cases, the switch can do crazy fast jump tables.
More information about the Digitalmars-d-learn
mailing list