[racket] Places performance

From: Harry Spier (vasishtha.spier at gmail.com)
Date: Wed Mar 13 21:23:22 EDT 2013

Dear members,

I've run the following racket program  (as an executable) to test the
performance of places on a windows dual core pentium machine under Vista.
 I've run this with various sizes for test-vector.  Even when the amount of
computation is large (test-vector-size = 5000000) the performance with the
computation split over two places takes more than double the time to
complete as when no places are used.

I'm not clear why on a dual core machine the performance wasn't better with
 the computation split over two places than with no places. In fact the
results are the opposite with the performance for no places always double
that for two places.

#lang racket
(require "place-timing-test.rkt")
(printf "test-vector-size ~a" test-vector-size)
(display "With places ")
(time (places-main))
(display "Without places ")
(time (noplaces-main))

(system "PAUSE")

#lang racket
(provide places-main noplaces-main test-vector-size)
(define test-vector (build-vector 5000000 +))
(define test-vector-size (vector-length test-vector))
(define (test-function vectr) (apply + (vector->list (vector-map sqrt

(define (places-main)
    (define place1
       (place ch (place-channel-put ch (test-function (place-channel-get

    (define place2
        (place ch (place-channel-put ch (test-function (place-channel-get

    (place-channel-put place1 test-vector)
    (place-channel-put place2 test-vector)
    (place-channel-get place1)
    (place-channel-get place2)
    (place-wait place1)
    (place-wait place2)

(define (noplaces-main)
    (test-function test-vector)
    (test-function test-vector)

These are the results for different sizes of test-vector.  The amount of
computation is linear to the size of test-vector.

test-vector-size 100000
With places cpu time: 1685 real time: 856 gc time: 0
Without places cpu time: 187 real time: 170 gc time: 94
Press any key to continue . . .
test-vector-size 1000000
With places cpu time: 3822 real time: 2637 gc time: 265
Without places cpu time: 1201 real time: 1191 gc time: 452
Press any key to continue . . .
test-vector-size 5000000
With places cpu time: 15787 real time: 23318 gc time: 1373
Without places cpu time: 7769 real time: 9456 gc time: 4461
Press any key to continue . . .

Harry Spier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130313/6a71ec44/attachment-0001.html>

Posted on the users mailing list.