[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Loop optimization
From: |
Mark H Weaver |
Subject: |
Re: Loop optimization |
Date: |
Mon, 07 Mar 2011 19:28:50 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Michael Ellis <address@hidden> writes:
> Thanks for the education, Andy, and congrats again on the guile
> compiler implementation. Your version handily outperforms the fastest
> python implementation I know.
That's especially impressive given that the two pieces of code below are
markedly different: The guile version formats 10 million integers and
outputs them, whereas the python version does nothing but count and
output the final value.
I'd be very curious to see the results of a _fair_ comparison.
Best,
Mark
>
> for i in xrange (10000000):
> pass
> print i
>
> real 0m0.641s
> user 0m0.625s
> sys 0m0.012s
>
>
> (let loop ((i 0))
> (if (<= 10000000 i)
> (begin (display i) (newline))
> (loop (1+ i))))
>
>
> real 0m0.495s
> user 0m0.465s
> sys 0m0.010s
>
> Cheers,
> Mike
>
>
>
> On Mon, Mar 7, 2011 at 4:36 PM, Andy Wingo <address@hidden> wrote:
>> (let loop ((i 0))
>> (if (<= 10000000 i)
>> (begin (display i) (newline))
>> (loop (1+ i))))