[llvm-dev] StringSwitch efficiency

Fāng-ruì Sòng via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 29 14:16:10 PDT 2020


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