fun project - improving calcHash

Timon Gehr timon.gehr at gmx.ch
Sun Jun 23 14:36:22 PDT 2013


On 06/23/2013 11:22 PM, Walter Bright wrote:
> https://github.com/D-Programming-Language/dmd/blob/master/src/root/stringtable.c#L21
>
>
> Profiling shows the calcHash function is a significant contributor to
> compilation time (3.25% of total time). So making it faster is a win.
> Even making dmd 1% faster would be a nice win - all those little drops
> add up.
>
> There are many, many string hash functions findable through google.
> Anyone want to spend the effort to make a faster one? Remember, ya gotta
> prove it's faster!
> ...

It seems to be easy to make it faster without changing the algorithm 
significantly. There should be only one switch executed, not one per 4 
characters. If the length is short enough from the start, there is no 
point in doing any arithmetic.



More information about the Digitalmars-d mailing list