-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
Description
I recently saw some code that used while i <= length(s) where s is a String. This can happen e.g. when porting code that assumes all data is ASCII. Obviously one answer is "don't do that", but it would be nice if we could handle this better. Two ideas:
- Tell LLVM that
length(::String)is pure and can be hoisted out of loops. - Use the top bit of the length field to store whether a string is ASCII, speeding up
lengthandisasciiin that case.
StefanKarpinski, ararslan and PallHaraldsson