shootout - nsieve-bits benchmark

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Fri Apr 21 19:00:45 CEST 2006


I noticed that Erlang HiPE times out on the nsieve-bits benchmark.
That's not very flattering, since the upper limit is 3600 seconds. (:

(http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lan
g=all)

I did some tests with the posted Erlang version, and it does take a
_very_ long time for large input (it also seems to return incorrect
values as N increases. I don't know why.)

I attach a version that uses an ordered_set ets table for a bit array.
It at least puts Erlang at the level of Tcl/JavaScript, and well before
Ruby (assuming that the Pentium 4 box performs at least as well as my
SunBLADE). It also matches the output of the other implementations (it
also seems to agree with Doug Bagley's old sieve program, found at
http://www.erlang.org/ml-archive/erlang-questions/200009/msg00010.html)

I haven't submitted it. Does anyone have a better implementation?

1> c(sv,[native]).           
{ok,sv}
2> timer:tc(sv,main,[["9"]]).
Primes up to  5120000  356244
Primes up to  2560000  187134
Primes up to  1280000   98610
{69606490,98610}

BR,
Ulf W
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sv.erl
Type: application/octet-stream
Size: 3409 bytes
Desc: sv.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060421/46396397/attachment.obj>


More information about the erlang-questions mailing list