[racket] Racket 5.3.4, 32-bit slow?

From: Joe Gilray (jgilray at gmail.com)
Date: Tue Jun 4 13:59:01 EDT 2013

The following code runs in reasonable time (about 5s) on 64-bit 5.3.4, but
takes about 20x as long on 32-bit.  I adapted this code from some scheme
code on the PE forum.  Thoughts?

Thanks,
-Joe

(define (euler210)
  (define limit (expt 10 8))
  (define ldiv4 (quotient limit 4))
  (define ldiv8 (quotient limit 8))
  (define ldiv8xrad2 (inexact->exact (floor (* ldiv8 (sqrt 2)))))
  (define sqrldiv8x2 (* ldiv8 ldiv8 2))
  (+
   (* 3 (* limit (/ limit 2)))  ; rectangular regions
   (- (* ldiv4 (add1 ldiv4)) 2)
   (* 8
      (let loop ([x (add1 ldiv8)] [sum 0])  ; 1/8 of circle points (outside
of inner square)
        (if (< ldiv8xrad2 x) sum
            (let* ([y (sqrt (- sqrldiv8x2 (* x x)))] [ymax (inexact->exact
(floor (if (integer? y) (- y 1) y)))])
              (loop (add1 x) (+ sum ymax))))))
   (* 4 (- ldiv8xrad2 ldiv8))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130604/fb08f2b3/attachment.html>

Posted on the users mailing list.