>
> I'm able to replicate the effects you describe on my 4-core machine, 
> but I'm not convinced that it's an issue with places. The effect seems 
>

very strange. i rewriten test to use (process ...) and communication over 
stdin/stdout.
with racket 6.x - 10 processes have much slower summary time.
time racket -t processtest.scm -m -- 1
time: 37948
real    0m40.397s
time racket -t processtest.scm -m -- 10
time: 87168
real    0m12.416s

but with racket 5.1.1:
time racket -t processtest.scm -m -- 1
time: 24084
real    0m25.075s
ime racket -t processtest.scm -m -- 10
time: 24413
real    0m4.189s

really weird and i dont know what to do =(

processtest.scm:
#lang racket
(provide main)
(define (child)
  (let* ((l (read-line))
         (n (string->number l)))
    (let ((start (current-milliseconds)))
      (cond
       ((equal? l "ping")
        (printf "pong\n")
        (flush-output (current-output-port))
        (child))
       ((number? n)
        (printf
         "~s~n"
         (and (let loop ((res '()) (n (* n 10)))
                (if (= n 0)
                    (apply + res)
                    (loop (cons n res) (sub1 n))))
              (- (current-milliseconds) start)))
        (flush-output (current-output-port))
        (child))))))
(define (get-avail p res)
  (cons
   (let loop ((avail '()))
     (if (null? avail)
         (loop (apply
                sync
                (map (lambda (pl)
                       (wrap-evt
                        (first pl)
                        (lambda (v)
                          (let ((R (read-line v)))
                            (set! res (cons R res)))
                          (list pl))))
                     p)))
         avail))
   res))
(define (main-loop n)
  (let ((p (let loop ((n n) (r '()))
             (if (= n 0)
                 r
                 (loop (sub1 n)
                       (cons (process "racket -t processtest.scm -m")
                             r)))))
        (numbers '(325220 295205 285260
                   146030 58810 231409
                   260650 58890 299280
                   168250 57320 120210
                   226100 325260 320180
                   251680 37310 275680
                   111010 288300 183890
                   325220 295205 285260
                   146030 58810 231409
                   260650 58890 299280
                   168250 57320 120210
                   226100 325260 320180
                   251680 37310 275680
                   111010 288300 183890)))
    (for-each (lambda (pl)
                (fprintf (second pl) "ping~n")
                (flush-output (second pl))
                (read-line (first pl)))
              p)
    (printf "all childs started, run~n")
    (let ((results (let loop ((numbers numbers) (a (cons p '())))
                     (if (null? numbers)
                         (cdr a)
                         (loop (cdr numbers)
                               (let ((a (if (not (null? (car a)))
                                            a
                                            (get-avail p (cdr a)))))
                                 (and (fprintf (second (car (car a))) 
"~a~n" (car numbers))
                                      (flush-output (second (car (car a))))
                                      (cons (cdr (car a))
                                            (cdr a)))))))))
      (let loop ((results results))
        (if (= (length results) (length numbers))
            (printf "time: ~a~n" (apply + (map string->number results)))
            (loop (cdr (get-avail p results))))))
    (for-each
     (lambda (pl)
       (fprintf (second pl) "quit~n")
       (flush-output (second pl)))
     p)))
(define (main . argv)
  (if (null? argv)
      (child)
      (main-loop (string->number (car argv)))))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/6a275792-ee38-4a6d-938a-dd60ecd10fca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to