[erlang-bugs] Slow process dictionary

Fredrik Svahn <>
Sun Dec 16 23:41:25 CET 2007

There seems to be something strange going on in the process dictionary in

Operations which would take a tenth of a second in R11B-5 can now take more
than 30 seconds. Please see test program below.

Archictecture and OS: Linux laptop 2.6.24-rc1 #4 SMP Wed Oct 31 20:35:25 CET
2007 x86_64 AMD Turion(tm) 64 X2 Mobile Technology TL-60 AuthenticAMD
Erlang environment: Erlang (BEAM) emulator version 5.6 [source] [64-bit]
[smp:2] [async-threads:0] [hipe] [kernel-poll:false]

Thanks to Isaac Gouy for pointing out the differences between R11B-5 and
R12B-0. The same problem can be found e.g. on the nsieve benchmark on the
Computer Language Shootout on Intel P4/Gentoo (

BR /Fredrik Svahn

$ otp_src_R11B-5/bin/erl -noshell -noinput -run test main 100000
$ otp_src_R11B-5/bin/erl -noshell -noinput -run test main 110000

$ erlc test.erl
$ erl -noshell -noinput -run test main 100000
$ erl -noshell -noinput -run test main 110000

-export([main/1, dict/1, reverse_dict/2]).

main([Arg]) ->
    io:format("~p~n",[timer:tc(?MODULE, reverse_dict, [N, 0])]),
    io:format("~p~n",[timer:tc(?MODULE, dict, [N])]),

reverse_dict(M, M) -> ok;
reverse_dict(M, I) -> put(M, 0), reverse_dict(M, I+1).

dict(1) -> ok;
dict(M) -> put(M, 0), dict(M-1).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20071216/9d41be72/attachment.html>

More information about the erlang-bugs mailing list