Table lookups - this is pretty definitive

Vladimir Panteleev vladimir at thecybershadow.net
Tue Apr 1 15:00:28 PDT 2014


On Tuesday, 1 April 2014 at 18:35:50 UTC, Walter Bright wrote:
> Try this benchmark comparing various classification schemes:

I modified it a bit to use the Phobos source code as the test 
data:
http://dump.thecybershadow.net/7a685ffb8588ec836e3ae0dba14e0618/test.d

My results (DMD git HEAD, -O -inline -release):

x86: 41070 29642 5169
x64: 42975 29759 5822

I've been using table lookups in my library for a while, e.g. for 
ASCII case conversions:

https://github.com/CyberShadow/ae/blob/master/utils/text.d#L323-L341

or escaping JSON strings:

https://github.com/CyberShadow/ae/blob/master/utils/json.d#L150-L188


More information about the Digitalmars-d mailing list