<div><span class="gmail_quote">On 21 Oct 2007 11:41:12 +0200, <b class="gmail_sendername">Bjorn Gustavsson</b> <<a href="mailto:bjorn@erix.ericsson.se">bjorn@erix.ericsson.se</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
"Anders Nygren" <<a href="mailto:anders.nygren@gmail.com">anders.nygren@gmail.com</a>> writes:<br>><br>> My only idea is that this is caused by some pathological CPU cache<br>> behaviour. Does anyone have a better explanation?
<br><br>Could be. I have another GUESS: using a tuple instead of dict will<br>result in a smaller heap size for the spawned process, which will lead<br>to more frequent garbage collections. You could use the spawn_opt()<br>
BIF with the min_heap_size option.<br><br>To get a similar heap size as when using a dict, use<br><br> erts_debug:size(wfbm3:init()).<br><br>which is 1120.<br></blockquote></div><br><div>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% speedup:
</div><div><br class="webkit-block-placeholder"></div><div><<a href="http://steve.vinoski.net/blog/2007/10/21/faster-wf-still/">http://steve.vinoski.net/blog/2007/10/21/faster-wf-still/</a>></div><div><br> </div><div>
--steve</div>