chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] big prime number


From: Claude Marinier
Subject: [Chicken-users] big prime number
Date: Sun, 24 Jan 2016 15:25:04 -0500

Bonjour,

Spurred by the recent excitement about a new largest prime number (1), I wanted to see how long it would take to just write the number. So I wrote a simple program and added timing to produce the following.

address@hidden:~/Programming/scheme$ ./big-prime 
time to compute big prime : 1.074 seconds
time to convert it to a string : 778.617 seconds
time to write it to a file : 710.805 seconds

I compiled the program on Debian 8 64-bit with Chicken 8.10.0 and Numbers 4.3 and "-O3". The CPU is an old dual-core Pentium E2200 @ 2.20GHz.

    Version 4.10.0 (rev b259631)
    linux-unix-clang-x86-64 [ 64bit manyargs dload ptables ]
    compiled 2015-08-04 on yves.more-magic.net (Linux)

Here is the program (minus timing code).

(use numbers)
(define big-prime (- (expt 2 74207281) 1))
(define big-print-str (number->string big-prime))
(define outport (open-output-file "big-prime.txt"))
(display big-prime outport) (newline outport)
(close-output-port outport)

A colleague claims a Haskell program calculating the prime and writing it to a file ran in 17 seconds. That's 89 times faster.

Am I missing something? Is 4.10.1 faster?

Back in June, there was talk of Numbers performance. Where do we stand now? Should I try the code in GIT?

Thank you.

P.S. He may have written the number in binary. That would explain a lot. Still, am I missing something? Hum ... I should probably use cpu-time instead of current-milliseconds but (oddly) I do not know have to deal with the two returned values. :-(

(1) http://www.mersenne.org/primes/?press=M74207281

--
Claude Marinier

reply via email to

[Prev in Thread] Current Thread [Next in Thread]