NightOwl888 / ICU4N

International Components for Unicode for .NET
Apache License 2.0
27 stars 7 forks source link

PERFORMANCE: ICU4N.Impl.RuleCharacterIterator: Fixed bottleneck when calling Lookahead() method #52

Closed NightOwl888 closed 1 year ago

NightOwl888 commented 1 year ago

The Substring() method in .NET performs horribly compared to Java. So, the Lookahead() method was modified to return ReadOnlySpan<char> so it can be sliced without allocating substrings.

On .NET Framework 4.0, we work around this by passing in the buffer instead of calling Lookahead().