Compiler benchmarks for an alternative to std.uni.asLowerCase.

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Mon May 9 01:44:53 PDT 2016


On 09-May-2016 02:38, Jon D wrote:
> I did a performance study on speeding up case conversion in
> std.uni.asLowerCase. Specifics for asLowerCase have been added to issue
> https://issues.dlang.org/show_bug.cgi?id=11229. Publishing here as some
> of the more general observations may be of wider interest.
>
> Background - Case conversion can generally be sped up by checking if a
> character is ascii before invoking a full unicode case conversion. The
> single character std.uni.toLower does this optimization, but
> std.uni.asLowerCase does not. asLowerCase does a lazy conversion of a
> range. For the test, I created a replacement for asLowerCase which uses
> map and toLower. In essence, `map!(x => x.toLower)` or `map!(x =>
> x.byDchar.toLower)`.

The only problem is that it should consider multi-codepoint replacements 
aka full-case folding in Unicode.
Otherwise - go ahead and issue a pull request to add
special case for < 0x80.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list