<div dir="ltr">You're doing way more work in the timed portion of the place version than you are in the non-place one. In the places one you're creating the test-vector 3 times, once in the original place (that you don't explicitly create) and once in each of the places that you create. Your code is also copying the vector from one place to another in the places one (ignoring the one that was created when the place was created).<div>
<br></div><div style>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 13, 2013 at 8:23 PM, Harry Spier <span dir="ltr"><<a href="mailto:vasishtha.spier@gmail.com" target="_blank">vasishtha.spier@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear members,<br></div><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>--------------------------------------</div><div>place-timing-test-executable.rkt</div><div>---------------------------------------</div><div>#lang racket<br>(require "place-timing-test.rkt")<br>
(printf "test-vector-size ~a" test-vector-size)<br>(newline)<br>(display "With places ")<br>(time (places-main))<br>(display "Without places ")<br>(time (noplaces-main))<br><br>(system "PAUSE")<br>
</div><div><br></div><div><br></div><div>-----------------------</div><div>place-timing-test.rkt</div><div>-----------------------</div><div>#lang racket<br>(provide places-main noplaces-main test-vector-size)<br>(define test-vector (build-vector 5000000 +))<br>
(define test-vector-size (vector-length test-vector))<br>(define (test-function vectr) (apply + (vector->list (vector-map sqrt vectr))))<br><br>(define (places-main)<br> (define place1 <br> (place ch (place-channel-put ch (test-function (place-channel-get ch)))))<br>
<br> (define place2 <br> (place ch (place-channel-put ch (test-function (place-channel-get ch)))))<br> <br> (place-channel-put place1 test-vector)<br> (place-channel-put place2 test-vector)<br> (place-channel-get place1)<br>
(place-channel-get place2)<br> (place-wait place1)<br> (place-wait place2)<br> (void))</div><div><br></div><div>(define (noplaces-main) <br> (test-function test-vector)<br> (test-function test-vector)<br>
(void)</div><div>-------------------------------</div><div><br></div><div>These are the results for different sizes of test-vector. The amount of computation is linear to the size of test-vector.</div><div><br></div>
<div>test-vector-size 100000<br>With places cpu time: 1685 real time: 856 gc time: 0<br>Without places cpu time: 187 real time: 170 gc time: 94<br>Press any key to continue . . .<br>-----<br>test-vector-size 1000000<br>With places cpu time: 3822 real time: 2637 gc time: 265<br>
Without places cpu time: 1201 real time: 1191 gc time: 452<br>Press any key to continue . . .<br>-------<br>test-vector-size 5000000<br>With places cpu time: 15787 real time: 23318 gc time: 1373<br>Without places cpu time: 7769 real time: 9456 gc time: 4461<br>
Press any key to continue . . .</div><div>------</div><div><br></div><div>Thanks,</div><div>Harry Spier</div>
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>