[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [plt-scheme] Divisions
I think your timing results include the time it takes Mz/DrScheme to
convert the numbers from strings to integers. Try this instead:
(define a
2341732847239419230619237419732491723946147651289374234173284723941923061923
7419732491723946147651289374234173284723941923061923741973249172394614765128
9374234173284723941923061923741973249172394614765128937423417328472394192306
1923741973249172394614765128937423417328472394192306234173284723941923061923
7419732491723946147651289374192374197324917239461476512893742341732847239419
23061923741973249172394614765128937412341234)
(define b
2491723946147651289374234173284723941923061923741973249172394614765128937423
4173284723941923061923741973249172394614765128937423417328472394192306192374
1973249172394614765128937423417328472394249172394614765128937423417328472394
1923061923741973249172394614765128937423417328472394192306192374197324917239
4614765128937423417328472394192306192374197324917239461476512893742341732847
2394)
(define (benchmark name)
(display name) (newline)
(let ([g (eval name)])
(time (apply g (list a b)))))
(map benchmark '(gcd ext-gcd ext-gcd-ndiv))
It gives considerably lower timings. So low that I think you
need to test on larger numbers.
--
Jens Axel Søgaard