On 08/09/2026 4:35 AM, H. S. Teoh wrote:
On Tue, Sep 08, 2026 at 04:20:42AM +1200, Richard (Rikki) Andrew Cattermole via 
Digitalmars-d-learn wrote:
On 08/09/2026 4:01 AM, 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. 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.

It probably needs optimizing.

Have at it.

Weren't string switches one of the original reasons for moving the
implementation of switch into a druntime template?  The argument was
that it would allow more flexibility in implementing fast string
lookups.  Apparently it hasn't happened yet. :-/


T

I have no knowledge of templating switch statements.

But I am aware of jump table optimizations, which are done by backends if they recognize the condition + jump tree.

  • str.to!Enum perf... realhet via Digitalmars-d-learn
    • Re: str.to!... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: str... realhet via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... H. S. Teoh via Digitalmars-d-learn
          • ... realhet via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... Nick Treleaven via Digitalmars-d-learn
      • Re: str... Johan via Digitalmars-d-learn
    • Re: str.to!... Per Nordlöw via Digitalmars-d-learn

Reply via email to