On Sun, Apr 21, 2013 at 8:06 PM, Ted Dunning <[email protected]> wrote:
> On Sun, Apr 21, 2013 at 1:14 AM, Dan Filimon <[email protected] > >wrote: > > > Would this not work? > > > [special loop to support multiple reader paradigm similar to map-reduce in > a threaded model] > > Yes. What you suggest would work. > > But multi-threaded assign would be very dangerous. Even if you assign > different parts of the vector to different threads, you have to worry about > cache line alignment which is generally not visible to Java without very > special effort. > I'm terrible at explaining what I mean. So, rather than have the threads assign chunks of a vector (which would only really work if the underlying Vector was an array of doubles), each thread would return an OrderedIntDoubleMapping, and they would be merged into a Vector by a single thread at the end. I wonder, even talking about cache alignment worries in Java makes me wonder whether we'd be trying to outwit the JVM. It feels kind of wrong, as I'm certain that the people writing Hotspot are better at optimizing the code than me. :)
