[racket] Places performance
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.
--------------------------------------
place-timing-test-executable.rkt
---------------------------------------
#lang racket
(require "place-timing-test.rkt")
(printf "test-vector-size ~a" test-vector-size)
(newline)
(display "With places ")
(time (places-main))
(display "Without places ")
(time (noplaces-main))
(system "PAUSE")
-----------------------
place-timing-test.rkt
-----------------------
#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
vectr))))
(define (places-main)
(define place1
(place ch (place-channel-put ch (test-function (place-channel-get
ch)))))
(define place2
(place ch (place-channel-put ch (test-function (place-channel-get
ch)))))
(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)
(void))
(define (noplaces-main)
(test-function test-vector)
(test-function test-vector)
(void)
-------------------------------
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 . . .
------
Thanks,
Harry Spier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130313/6a71ec44/attachment-0001.html>