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

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Nov 27 04:06:05 PST 2012


11/27/2012 3:47 PM, monarch_dodra пишет:
> 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 ^^
>
Also I recall German has surprisingly interesting mix of unicode & ascii.

>>> 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"...?
>

That would the -release switch. It has the effect of removing asserts 
and bounds checks from @system code. -noboundscheck will kill all of 
them everywhere I believe.

The dedicated to -release switch TDPL table goes as following:
              Safe  System
Non-release:  +      +
Release:      +      -

Except that '-' in a the book is marked as a skull-and-crossbones :)

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list