[plt-scheme] FrTime: Animations get slow on Mac OSX...

From: Cyprien Nicolas (c.nicolas at gmail.com)
Date: Tue Apr 10 06:44:54 EDT 2007

Hi all,

First, sorry for not so good English.

I am trying to make a ball bouncing using FrTime, I have entered that code :


(require (lib "frp-core.ss" "frtime")
         (lib "animation.ss" "frtime"))

(define-values (bx by) (values 15 45))
(define-values (vx vy) (values  1  2))
(define ny 350)
(define DELAY 1)

(define (update-bx) ; Manage x coordinate
  (set! bx (+ bx vx))
  (if (or (< bx 10) (> bx 390))
      (set! vx (- vx)))
  bx)
(define (update-by) ; Manage y coordinate
  (set! by (+ by vy))
  (if (or (< by 10) (> by 390))
      (set! vy (- vy)))
  by)

(define ball-coord ; The signal used to manage ball position
  (let ([ret (proc->signal void)])
    (set-signal-thunk! ret
                       (lambda ()
                         (let ([t (current-milliseconds)]
                               [x (update-bx)]
                               [y (update-by)])
                           (schedule-alarm (+ DELAY t) ret)
                           (make-posn x y))))
    (set-signal-value! ret ((signal-thunk ret)))
    ret))

(display-shapes
 (let ((nx (- (posn-x mouse-pos) 15)))
     (list
      (make-rect (make-posn nx ny) 30 10 "blue")
      (make-circle ball-coord 10 "red"))))


That code works fine running Linux and Windows, but there is some
short slow down running OSX.
I had a similar problem using MrEd libraries to do the same thing with
objects. The speed of animation is constant on Linux, and alternate
with faster and slower speeds on Mac OS.

I don't have any idea where this comes from.

I'm using DrScheme 369.8-svn19feb2007 [3m] (installed on the
university's computers),
using the following hardware :

  CPU :	Intel Core 2 Duo
  Frequency :	2 GHz
  Number of cores :	2
  L2 cache :	4 Mo
  RAM :	1 Go
  RAM speed :	667 MHz

Thanks,
Cyprien Nicolas
c.nicolas at gmail.com


Posted on the users mailing list.