chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Crunch performance (really strange) -- resolved


From: Jeronimo Pellegrini
Subject: Re: [Chicken-users] Crunch performance (really strange) -- resolved
Date: Fri, 6 Nov 2009 01:43:13 -0200
User-agent: Mutt/1.5.20 (2009-06-14)

Ah, I know what happened!

I'm sorry -- I was sleepy when I modified this macro:

(cond-expand
 (crunched (import crunch))
 (else
  (define-syntax crunch
    (syntax-rules ()
      ((_ body ...) (begin (display "Crunch works") body ...) ) ) ) ) )

So I kept thinking I was using crunch ("Crunch works") when
it was actually the opposite! (And I didn't know I had to add
"-D crunched" when compiling -- I only learnt that when I took
a look at the egg source)

(And the code for version #3 doesn't compile with crunch, because
 it would have to use vector-ref)

Now the crunched version (single-vector) is much faster: 155s
That's not like C++ of course, but it's much better than before!
(I have also written an optimized Common Lisp version which ran in
90 seconds).

I'm sorry for the noise. It seems that crunch works really well!

Thanks!
J.

On Thu, Nov 05, 2009 at 11:11:20AM -0200, Jeronimo Pellegrini wrote:
> Hello,
> 
> So, I have been learning more about crunch, and I
> decided to run some tests, and the resuts are, well,
> very srtange.
> 
> I have ran four different versions of the "naive multiply
> matrices" algorithm:
> 
> 1) mm-vectorvector: implements the matrix as a vector of
>    vectors;
> 
> 2) mm-singlevector: implements the matrix as a single
>    long vector, and calculates the index when needed
> 
> 3) mm-vectorvector-crunch: like #1, but using crunch
> 
> 4) mm-singlevector-crunch: like #2, but using crunch
> 
> 
> These are modifications that I did in the code that was
> included in the git repo with the crunch egg.
> 
> 
> The results are puzzling:
> 
> cpp                     19.41 seconds
> mm-vectorvector         267.164
> mm-vectorvector-crunch  882.523
> mm-singlevector         911.945
> mm-singlevector-crunch  886.307
> 
> (On an AMD64, 1GHz running Linux 2.6.30)
> 
> So the vector-of-vectors approach runs faster than
> all other Scheme versions (!)
> 
> I have uploaded all files here:
> http://aleph0.info/scheme/
> 
> To run the tests,
> 
> $ make
> $ echo "1" | ./cpp
> $ ./mm-vectorvector        1 1000x1000x.mat 1000x1000y.mat
> $ ./mm-singlevector        1 1000x1000x.mat 1000x1000y.mat
> $ ./mm-vectorvector-crunch 1 1000x1000x.mat 1000x1000y.mat
> $ ./mm-singlevector-crunch 1 1000x1000x.mat 1000x1000y.mat
> 
> What could have happened?
> 
> Thanks,
> J.
> 
> 
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]