Table lookups - this is pretty definitive

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Apr 1 12:46:52 PDT 2014


01-Apr-2014 22:35, Walter Bright пишет:
> Try this benchmark comparing various classification schemes:

> int f0()
> {
>      int x;
>      for (uint u = 0; u < 0x100; ++u)
>      {
>          x += isIdentifierChar0(cast(ubyte)u);
>      }
>      return x;
> }
>
> int f1()
> {
>      int x;
>      for (uint u = 0; u < 0x100; ++u)
>      {
>          x += isIdentifierChar1(cast(ubyte)u);
>      }
>      return x;
> }
>
> int f2()
> {
>      int x;
>      for (uint u = 0; u < 0x100; ++u)
>      {
>          x += isIdentifierChar2(cast(ubyte)u);
>      }
>      return x;
> }

Would strongly suggest to use 2 kinds of data - randomized and some 
text. And, of course, it must be loaded at run-time.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list