Major performance problem with std.array.front()

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Sun Mar 9 14:14:31 PDT 2014


On 3/9/2014 11:21 AM, Vladimir Panteleev wrote:
> 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.

Yea, I've had problems before - completely unnecessary problems that 
were *not* helpful or indicative of latent bugs - which were a direct 
result of Phobos being overly pedantic and eager about UTF validation. 
And yet the implicit UTF validation has never actually *helped* me in 
any way.



More information about the Digitalmars-d mailing list