3 ms·
Isn't ASCII indexing constant time and Unicode grapheme indexing ~linear time?
by nitrogen 7y ago
Isn't ASCII indexing constant time and Unicode grapheme indexing ~linear time?
- ninkendo 7y agoCorrect, i seem to have quoted the wrong part of the GP comment... I meant to address this quote: > adding a special flag to indicate all characters in the string are ASCII, so that we can still use O(1) indexing in this case But I got confused and addressed the linear indexing part. But yeah, ASCII is constant time, but you can’t assume even UTF-32 can be constant time due to variable length grapheme clusters.