"foreach(i, dchar c; s)" vs "decode"

monarch_dodra monarchdodra at gmail.com
Tue Nov 27 03:47:19 PST 2012


On Tuesday, 27 November 2012 at 09:15:02 UTC, Dmitry Olshansky 
wrote:
>> I benched using varied sources of data, in particular, both 
>> ASCII only
>> strings, as well as unicode heavy text.
>
> Nothing better then a dump of Arabic wiki ? ;)

I benched with a dump of the japanese wiki actually ^^

>> Unicode has better gains, but raw ASCII text is *also* has 
>> gains :/
>> this holds true for both UTF-8 and UTF-16.
>>
>> UTF-32 is different, because foreach has the "unfair" 
>> advantage of not
>> validating the code points...
>>
>> I got these results on 2.061 alpha release, with phobos in 
>> release and
>> both -inline and without inline.
>
> Don't forget the -O -noboundscheck. As some things are safe and 
> thus always have bounds check.

I though "noboundscheck" only had an effect on code marked 
"@system"...?



More information about the Digitalmars-d mailing list