Using futures (via the wonderfully simple for/async), I'm seeing a long sequence of numbers like these:
cpu: 256599 real: 4585 gc: 3065
I'm quite happy with the speedup I already get, but it appears that the GC is taking a lot of time (I suppose the 3065 ms of GC are 'real' ms), so I'm hoping I could shave some more seconds off it.
But I don't yet see where in my code I could reduce the GC time.
The code isn't opensource yet so I can't share it unfortunately, but it uses the following operations:
untyped flonum and fixnum operations (and not using math/flonum), including flvector-set!, in-flvector and fxquotient
Are there additional general advice about how to reduce the GC time?
Would turning defines to lets make any difference?
Increasing PLT_CS_COMPILE_LIMIT?
Could Typed Racket help with this?
Fixnums don't allocate, so there's no need to worry about them taking space in the heap. For flonums, you'll really need to use more specialized data structures to avoid boxing.
So is there any GC-difference between (for ([idx (in-list a-fixnum-list)]) ...) and (for ([idx (in-fxvector a-fxvector)]) ...), for example with respect to cons cells?
The list will feature N separate allocations, and N-1 pointers, so GC traversal will take somewhat longer. It will take about 2N space. The fxvector will take about N space, and have no interior pointers, so it will take only constant time to traverse in the GC. A plain vector with fixnums in it will also take about N space, but the whole vector will be traversed by the GC.