<div dir="ltr">Perhaps the EXEs take longer because they are not using a shared image of Racket, thus the OS must load code that is 99% equivalent from two different disk locations.<br></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Wed, May 8, 2013 at 7:55 AM, Manfred Lotz <span dir="ltr"><<a href="mailto:manfred.lotz@arcor.de" target="_blank">manfred.lotz@arcor.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 8 May 2013 07:31:37 -0400<br>
<div><div class="h5">Carl Eastlund <<a href="mailto:cce@ccs.neu.edu">cce@ccs.neu.edu</a>> wrote:<br>
<br>
> On Wed, May 8, 2013 at 7:04 AM, Manfred Lotz<br>
> <<a href="mailto:manfred.lotz@arcor.de">manfred.lotz@arcor.de</a>> wrote:<br>
><br>
> > On Wed, 8 May 2013 06:19:27 -0400<br>
> > Carl Eastlund <<a href="mailto:cce@ccs.neu.edu">cce@ccs.neu.edu</a>> wrote:<br>
> ><br>
> > > I'm seeing similar results on my end; I timed by first running<br>
> > > "raco make" on both files, then timing "racket" on both. I think<br>
> > > what we're seeing is a small startup time cost on Typed Racket.<br>
> > > I ran a longer benchmark and Typed Racket edges out untyped<br>
> > > Racket if I run a few million iterations (given this is such a<br>
> > > short computation). The expressions I used are:<br>
> > ><br>
> > > ;; utest.rkt<br>
> > > (void<br>
> > > (for/list {[i (in-range (* 10 1000 1000))]}<br>
> > > (distance<br>
> > > (pt (+ i 1.2) (+ i 2.1))<br>
> > > (pt (+ i 4.3) (+ i 5.6)))))<br>
> > ><br>
> > > and<br>
> > ><br>
> > > ;; test.rkt<br>
> > > (void<br>
> > > (for/list: : (Listof Float) {[i (in-range (* 10 1000 1000))]}<br>
> > > (distance<br>
> > > (pt (+ i 1.2) (+ i 2.1))<br>
> > > (pt (+ i 4.3) (+ i 5.6)))))<br>
> > ><br>
> > ><br>
> > > I see just under 5 seconds for test.rkt and just over 5 seconds<br>
> > > for utest.rkt. So there's a fraction of a second extra startup<br>
> > > time for Typed Racket, but it takes less time for each subsequent<br>
> > > computation, so the difference depends on how much "real" work<br>
> > > you do after startup. I don't know what causes that startup<br>
> > > cost, but hopefully this kind of benchmark will be useful to the<br>
> > > Typed Racket maintainers in closing the gap for future versions.<br>
> > > So, thanks for the example, Manfred!<br>
> > ><br>
> ><br>
> > Hi Carl,<br>
> > This is interesting. If I run it I have around 5 seconds for the<br>
> > typed version and around 4 seconds for the untyped version. My<br>
> > system is a 64bit Linux.<br>
> ><br>
> > --<br>
> > Manfred<br>
> ><br>
><br>
> What I ran was:<br>
><br>
> raco make test.rkt utest.rkt && time racket test.rkt && time racket<br>
> utest.rkt<br>
><br>
> Just to make sure we're comparing apples to apples, does that give<br>
> you the same results you saw before?<br>
><br>
><br>
<br>
</div></div>Yep, I did something different:<br>
<br>
Now going your way I get 3.7 sec for typed and 4.1 sec for untyped. It<br>
is interesting to note that if I do raco exe for both the executables<br>
run longer: 4 sec for typed and 4.7 sec for untyped.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
> > > On Wed, May 8, 2013 at 5:32 AM, Manfred Lotz<br>
> > > <<a href="mailto:manfred.lotz@arcor.de">manfred.lotz@arcor.de</a>> wrote:<br>
> > ><br>
> > > > Hi there,<br>
> > > > I did a small test using typed racket.<br>
> > > ><br>
> > > > This is an example from the documentation:<br>
> > > ><br>
> > > > #lang typed/racket<br>
> > > > ;; test.rkt<br>
> > > ><br>
> > > > (struct: pt ([x : Float] [y : Float]))<br>
> > > ><br>
> > > > (: distance (pt pt -> Float))<br>
> > > > (define (distance p1 p2)<br>
> > > > (sqrt (+ (sqr (- (pt-x p2) (pt-x p1)))<br>
> > > > (sqr (- (pt-y p2) (pt-y p1))))))<br>
> > > ><br>
> > > > (distance (pt 1.2 2.1) (pt 4.3 5.6))<br>
> > > ><br>
> > > > This is the untyped version:<br>
> > > > #lang racket<br>
> > > > ;; utest.rkt<br>
> > > ><br>
> > > > (struct pt (x y))<br>
> > > ><br>
> > > > (define (distance p1 p2)<br>
> > > > (sqrt (+ (sqr (- (pt-x p2) (pt-x p1)))<br>
> > > > (sqr (- (pt-y p2) (pt-y p1))))))<br>
> > > ><br>
> > > > (distance (pt 1.2 2.1) (pt 4.3 5.6))<br>
> > > ><br>
> > > ><br>
> > > > Now running both:<br>
> > > > time racket test.rkt<br>
> > > > 4.675467891024383<br>
> > > > racket test.rkt 1.24s user 0.08s system 99% cpu 1.333 total<br>
> > > ><br>
> > > ><br>
> > > > time racket utest.rkt<br>
> > > > 4.675467891024383<br>
> > > > racket utest.rkt 0.22s user 0.03s system 99% cpu 0.248 total<br>
> > > ><br>
> > > ><br>
> > > > It seems the typed version needs a lot of time for the type<br>
> > > > checking. The time for time checking could be cut mostly by:<br>
> > > ><br>
> > > > raco exe test.rkt<br>
> > > > time ./test<br>
> > > > 4.675467891024383<br>
> > > > ./test 0.49s user 0.03s system 99% cpu 0.531 total<br>
> > > ><br>
> > > > But still runtime is more than twice as long. I could get the<br>
> > > > impression that typed racket is generally slower.<br>
> > > ><br>
> > > ><br>
> > > > Question: Is there any conclusion to be drawn from this (like<br>
> > > > that typed racket is slower than 'normal' racket)? Or is my<br>
> > > > test just a bad test?<br>
> > > ><br>
> > > ><br>
> > > > --<br>
> > > > Manfred<br>
> ><br>
><br>
<br>
<br>
</div></div><div class="HOEnZb"><div class="h5">____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div>