Why Strings as Classes?

bearophile bearophileHUGS at lycos.com
Wed Aug 27 11:15:21 PDT 2008


Manfred_Nowak:
> Biggest of all: using the wrong tool. I.e. using a hash map for a 
> maximal populated key range.

But if the hash machinery is good it must work well in this common situation too.

Anyway, let's see how I can write a benchmark that you may like. I can use a very fast random generator to create random integer keys. This will probably make the Python version in disadvantage, because such language isn't fit for doing integer operations as fast as a compiled language (a sum among two integers may be 100 times slower in Python). This problem can be solved pre-computing the numbers first and putting them in the associative array later.
Is this enough to satisfy you?

Note that in the meantime I have created another associative array benchmark, this is string-based, and this time Python-Psyco comes out only about 2-2.5 times faster. I'll show it when I can...

Bye,
bearophile



More information about the Digitalmars-d mailing list