[erlang-questions] Strange optimization result

Steve Vinoski <>
Sun Oct 21 17:12:19 CEST 2007

On 21 Oct 2007 11:41:12 +0200, Bjorn Gustavsson <>
> "Anders Nygren" <> writes:
> >
> > My only idea is that this is caused by some pathological CPU cache
> > behaviour. Does anyone have a better explanation?
> Could be. I have another GUESS: using a tuple instead of dict will
> result in a smaller heap size for the spawned process, which will lead
> to more frequent garbage collections. You could use the spawn_opt()
> BIF with the min_heap_size option.
> To get a similar heap size as when using a dict, use
>         erts_debug:size(wfbm3:init()).
> which is 1120.

I didn't try this or Bob's suggestion of simulating a tuple, but I did
eliminate a dict lookup in the code that finds shift values, and also
changed the macros to use hard-coded string lengths (since the strings are
fixed) rather than recalculating them with length/1, and got another 25%


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071021/0f44aac1/attachment.html>

More information about the erlang-questions mailing list