
* Roman Cheplyaka
I'm trying to optimize the following program: http://github.com/feuerbach/particles/blob/303c8a17c9b732e22457b5409bdce4b75...
Of course general suggestions are welcome (BTW I'm going to give a try to vector), but currently I'm concerned with two questions:
1. Heavy allocations in 'distance' function. Here is (part of) the profile:
COST CENTRE MODULE %time %alloc ticks bytes
d2 Main 9.0 22.0 290 600000000 d Main 8.6 65.9 278 1800000000 d1 Main 7.5 11.0 242 299700000
From reading core I got the impression that everything is strict & unboxed. Perhaps this is related to creating some closures? How to get rid of those allocations?
2. Again from reading the core I learned that although 'l' and other constants are inlined, their type is boxed Double. This makes sense since CAFs are evaluated on demand, but obviously in this particular case it does not make sense, so can I somehow make them unboxed?
Forgot to mention, I'm using ghc 6.12.1, compiling with -O2. -- Roman I. Cheplyaka :: http://ro-che.info/ "Don't let school get in the way of your education." - Mark Twain