[llvm-dev] StringSwitch efficiency
Chris Lattner via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 30 22:05:49 PDT 2020
I agree - something that was true years ago is not necessarily still valid today.
-Chris
> On Oct 29, 2020, at 2:16 PM, Fāng-ruì Sòng <maskray at google.com> wrote:
>
> This may still need a measurement. StringSwitch takes a StringRef
> (const char *Data + size_t Length). The compiler cannot arbitrarily
> reference Data[i] if i >= Length. It can do specialization but it
> needs to know the valid range.
>
> On Thu, Oct 29, 2020 at 11:53 AM Paul C. Anagnostopoulos via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>>
>> Excellent. Then I shall not concern myself with the efficiency of StringSwitch.
>>
>> At 10/29/2020 02:28 PM, Chris Lattner wrote:
>>> Yeah, years ago, the compiler did the right thing through a combination of jump threading and simple redundancy elimination. StringSwitch does a first character specialization IIRC.
>>>
>>> -Chris
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> --
> 宋方睿
More information about the llvm-dev
mailing list