2 ms·
The java internal representation previously had a look up table for each Nth char (let's say 128, which is a nice round number), and if the indexes increased by
by bjoli 5y ago
The java internal representation previously had a look up table for each Nth char (let's say 128, which is a nice round number), and if the indexes increased by 128 between every 128 chars it simply did a linear lookup. For most text this means constant time access, instead of a linear search through the 128 chars.
I don't think the benefits against a utf-8 system with a LUT would be very big, but as a retrofitted system (which it was) it is not bad. Pretty compact with mostly constant time access.