chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Speeding up bit-vector operation (using iset)


From: Lasse Kliemann
Subject: Re: [Chicken-users] Speeding up bit-vector operation (using iset)
Date: Wed, 17 Mar 2010 17:00:27 +0100

* Message by -Alex Shinn- from Wed 2010-03-17:
> Lasse Kliemann <address@hidden> writes:
> 
> > It creates two large bit-vectors, initializes them with
> > random entries, and then performs and, ior, and nand
> > operations (corresponding to intersection, union, and
> > difference of the sets defined by the vectors) a number of
> > 10 times.
> 
> At 2^26 bits each I would say these are *huge* bit-vectors.
> 
> > (do
> >   ((i 0 (+ 1 i)))
> >   ((= i 10))
> >   (bit-vector-and s1 s2)
> >   (bit-vector-ior s1 s2)
> >   (bit-vector-and s1 (bit-vector-nand s2)))
> 
> These operations are generating three new huge bit-vectors
> on each iteration, so you're spending all your time in GC
> (and the loop has no effect).

Can this be prevented? For example, by having the result written 
to the same bit-vector each time, in order that no new memory has 
to be allocated?

> If you want to do in-place bit-vector operations you want
> `bit-vector-and!' and `bit-vector-ior!' (with the trailing
> exclamation point).

I tried this, but it did not change the time spent on the loop.

(However, I already achieved a speed-up down to approx. 114 
seconds by also compiling the extension with high optimization.)

Attachment: pgppt7Je2DgBY.pgp
Description: PGP signature


reply via email to

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