Major performance problem with std.array.front()

Vladimir Panteleev vladimir at thecybershadow.net
Sun Mar 9 08:21:20 PDT 2014


On Sunday, 9 March 2014 at 12:24:11 UTC, ponce wrote:
>> - In lots of places, I've discovered that Phobos did UTF 
>> decoding (thus murdering performance) when it didn't need to. 
>> Such cases included format (now fixed), appender (now fixed), 
>> startsWith (now fixed - recently), skipOver (still unfixed). 
>> These have caused latent bugs in my programs that happened to 
>> be fed non-UTF data. There's no reason for why D should fail 
>> on non-UTF data if it has no reason to decode it in the first 
>> place! These failures have only served to identify places in 
>> Phobos where redundant decoding was occurring.
>
> With all due respect, D string type is exclusively for UTF-8 
> strings. If it is not valid UTF-8, it should never had been a D 
> string in the first place. In the other cases, ubyte[] is there.

This is an arbitrary self-imposed limitation caused by the choice 
in how strings are handled in Phobos.


More information about the Digitalmars-d mailing list