PROPOSAL: fold keyword
tim at peierls.net
Tue Mar 10 10:01:01 PDT 2009
On Tue, Mar 10, 2009 at 11:51 AM, Gabriel Belingueres <belingueres at gmail.com
> I'm not specially familiar with this library, but seems like it is the
concurrent equivalent to what can be done with the Apache Commons
It's a bit different from Apache Commons Collections. I think of it loosely
as MapReduce for an in-memory array.
The big reason to use ParallelArray is that is performs very well on
multiprocessors without the user having to write special code to take
advantage of parallelism. Interestingly, when I first experimented with it I
saw a speedup of ParallelArray over equivalent sequential code on a machine
with one hyper-threaded physical processor (2 logical processors). That
really surprised me.
> Though the method call is very readable (given the
> appropriate naming of the predicates and mapping), this need the extra
> objects and anonymous classes I wanted to avoid creating. Not that
> there is anything wrong with that, it is just I wanted to find a more
> straightforward way to do it (if there is any).
Simple sequential code is more straightforward, as Josh demonstrated.
Why does creating the extra objects bother you? You're not creating those
objects in the inner loop. One Predicate object can be used for gazillions
of predicate tests and it takes up almost no memory.
More information about the coin-dev