Arrays vs tuples / lists

Einar Karttunen <>
Sun May 23 10:05:35 CEST 2004


On 22.05 10:02, Thomas Lindgren wrote:
> On the other hand, the shared-heap implementation
> could conceivably avoid copying. I haven't checked
> whether it actually does so.

I did some quick benchmarking with the test module in
this thread. It appears that shared heap does not 
improve performance in this case. However hipe makes
the tuple case much faster.

- Einar Karttunen
-------------- next part --------------
:~$ erl
Erlang (BEAM) emulator version 5.3 [source] [hipe] [threads:0]

Eshell V5.3  (abort with ^G)
1> c(test).
{ok,test}
2> [test:tup(1000, small), test:tup(1000, medium), 
2>  test:ets(1000, small), test:ets(1000, medium), 
2>  test:empty(1000)]
2> .
[{871445,ok},{869860,ok},{5069710,ok},{10382329,ok},{771318,ok}]
3> halt().
:~$ erl
Erlang (BEAM) emulator version 5.3 [source] [hipe] [threads:0]

Eshell V5.3  (abort with ^G)
1> c(test, [native, {hipe, [o3]}]).
{ok,test}
2> [test:tup(1000, small), test:tup(1000, medium), 
2>  test:ets(1000, small), test:ets(1000, medium), 
2>  test:empty(1000)].
[{141997,ok},{136991,ok},{3732640,ok},{8808114,ok},{78245,ok}]
3> halt().
:~$ erl -shared
Erlang (BEAM) emulator version 5.3 [source] [hipe] [shared heap] [threads:0]

Eshell V5.3  (abort with ^G)
1> c(test).
{ok,test}
2> [test:tup(1000, small), test:tup(1000, medium), 
2>  test:ets(1000, small), test:ets(1000, medium), 
2>  test:empty(1000)].
[{928735,ok},{930875,ok},{6444766,ok},{12715661,ok},{782807,ok}]
3> halt().
:~$ erl - shared
Erlang (BEAM) emulator version 5.3 [source] [hipe] [threads:0]

Eshell V5.3  (abort with ^G)
1> c(test, [native, {hipe, [o3]}]).
{ok,test}
2> [test:tup(1000, small), test:tup(1000, medium), 
2>  test:ets(1000, small), test:ets(1000, medium), 
2>  test:empty(1000)].
[{127755,ok},{135648,ok},{3726952,ok},{8795784,ok},{80775,ok}]
3> halt().


More information about the erlang-questions mailing list