From: Bruce Hoult <bruce@hoult.org>
To: Xavier Leroy <Xavier.Leroy@inria.fr>, Chris Hecker <checker@d6.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] bigarrays and toplevel on Win32?
Date: Tue, 6 Mar 2001 09:52:33 +1300 [thread overview]
Message-ID: <a0431010eb6c9a7d2fd0d@[192.168.0.12]> (raw)
In-Reply-To: <20010305175715.B16895@pauillac.inria.fr>
>The party line on unsafe array accesses is unclear: on the one hand,
>we do not want to encourage their use, as it can break type safety and
>dramatically reduce the safety of the programs; on the other hand,
>they are handy when benchmarking against C or Fortran :-)
We've got a benchmark over at Gwydion Dylan that does a simpleminded
Sieve of Eratosthenes
<http://www.ccc.de/cgi-bin/cvsweb/gd/examples/sieve-mark/>
While our Dylan code is currently a bit slower than C (about 11%),
the presence or absence of array bounds checking makes almost no
difference at all on modern superscalar CPUs such as the P6 (P-Pro,
PII, PIII) or PowerPC G3/G4.
Five Hundred Thousand Integer Sieve
===================================
Implementation Seconds
-------------- -------
C 0.33
Dylan w/o bounds checks 0.37
Dylan w/ bounds checks 0.38
Python w/ 'for' loops 11.40
Python w/ 'while' loops 15.03
Perl 5 24.58
Five Million Integer Sieve of Eratosthenes
==========================================
Implementation Seconds
-------------- -------
C 3.90
Dylan w/o bounds checks 4.33
Dylan w/ bounds checks 4.35
Python w/ 'for' loops FAILED (massive swapping)
Python w/ 'while' loops 156.83
Perl 5 FAILED (bad vector representation?)
-- Bruce
-------------------------------------------------------
The Dylan code is below. The other language implementation can be
found in the CVS (via the web as above, or from
:pserver:anoncvs@berlin.ccc.de:/home/cvsroot
define constant $fixed-bound = 500000;
define constant <int-vector> =
limited(<simple-vector>, of: <integer>, size: $fixed-bound);
define function main()
let vec :: <int-vector> = make(<int-vector>, fill: 0);
for (i from 0 below vec.size)
vec[i] := i + 1;
end for;
vec[0] := 0;
let prime-count = 0;
for (i from 1 below vec.size)
if (vec[i] ~= 0)
prime-count := prime-count + 1;
let prime = i + 1;
for (j from (i + prime) below vec.size by prime)
vec[j] := 0;
end for;
end if;
end for;
format("There are %d primes less than or equal to %d.\n",
prime-count, $fixed-bound);
end function main;
main();
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-03-05 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-05 7:43 Chris Hecker
2001-03-05 16:57 ` Xavier Leroy
2001-03-05 17:37 ` Chris Hecker
2001-03-06 17:18 ` Brian Rogoff
2001-03-05 20:52 ` Bruce Hoult [this message]
2001-03-05 21:28 ` John Prevost
2001-03-07 16:00 ` Dan Grossman
2001-03-07 21:04 ` John Prevost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='a0431010eb6c9a7d2fd0d@[192.168.0.12]' \
--to=bruce@hoult.org \
--cc=Xavier.Leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=checker@d6.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox