From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA22937; Mon, 5 Mar 2001 21:53:40 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA22971 for ; Mon, 5 Mar 2001 21:53:39 +0100 (MET) Received: from smtp4.ihug.co.nz (smtp4.ihug.co.nz [203.109.252.5]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f25Kra902148; Mon, 5 Mar 2001 21:53:36 +0100 (MET) Received: from [192.168.0.12] (p44-max1.wlg.ihug.co.nz [203.173.230.44]) by smtp4.ihug.co.nz (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id JAA15307; Tue, 6 Mar 2001 09:53:25 +1300 X-Authentication-Warning: smtp4.ihug.co.nz: Host p44-max1.wlg.ihug.co.nz [203.173.230.44] claimed to be [192.168.0.12] Mime-Version: 1.0 X-Sender: bruce@209.163.245.148 Message-Id: In-Reply-To: <20010305175715.B16895@pauillac.inria.fr> References: <4.3.2.7.2.20010304234009.00e1e220@shell16.ba.best.com> <20010305175715.B16895@pauillac.inria.fr> Date: Tue, 6 Mar 2001 09:52:33 +1300 To: Xavier Leroy , Chris Hecker From: Bruce Hoult Subject: Re: [Caml-list] bigarrays and toplevel on Win32? Cc: caml-list@inria.fr Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >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 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 = limited(, of: , size: $fixed-bound); define function main() let vec :: = make(, 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