Text-scanning loops get much faster
A big win for any code that walks through text character by character, which is how a huge amount of the web works under the hood: hashing strings for lookups, tokenizing and parsing (JSON, templates, code highlighting), and scanning for patterns. The classic shape is a loop from zero up to the text's length reading each character's code. The catch was that asking for the character at position N used to mean counting from the start each time, so a loop over a string of length N did work proportional to N squared, which gets slow fast on longer text. Floati now works out the string's characters once at the start of the loop and then reads any position instantly, turning that N-squared into plain N. In our benchmark, hashing a twenty-thousand-character string runs about twenty times faster. It returns exactly the same character codes and length the interpreter would, and steps back to the normal path for anything unusual, so results never change. The full engine test suite passes identically with the speed-up switched on and off.