[racket] gc and vectors

From: Jos Koot (jos.koot at telefonica.net)
Date: Mon Jan 24 14:19:47 EST 2011

I have tried fxvectors and it reduces GC time very much. I also found that
on my dual core/processor machine, I can use a future alongside de main
program in order to assign values to the vector parallelly (of course making
sure that the two processes do not access the same elements) I came up to
100% usage for both processors (without any other app being active)
Thanks. Jos 

> -----Original Message-----
> From: Matthew Flatt [mailto:mflatt at cs.utah.edu] 
> Sent: 04 January 2011 18:52
> To: Jos Koot
> Cc: users at racket-lang.org
> Subject: Re: [racket] gc and vectors
> You could use flvectors instead of vectors. If you feed numbers
> extracted from `flvector-ref' directly into `fl' arithmetic, 
> and if you
> push numbers directly from `fl' arithmetic back into `flvector-set!',
> that might save allocation and speed things up.
> Otherwise, if you're spending so much time on GC, you might tuning the
> GC by allocating and retaining a big byte array on the side (which
> convinces the GC that it doesn't need to collect so frequently, since
> you're willing to spend all that memory on a byte array anyway).
> At Tue, 4 Jan 2011 18:36:35 +0100, "Jos Koot" wrote:
> > I have a simple program using vectors of inexact numbers.
> > Half the time goes to garbage collection.
> > I suppose that's because vectors effectively are internally 
> arrays of
> > pointers to the numbers.
> > So reassigning an element to a vector may leave garbage.
> > Do unsafe floating point vectors and operations use arrays without
> > intermediate pointers?
> > If that is the case I could speed up my program by a factor of 2.
> > But before trying that I would appreciate advice.

Posted on the users mailing list.