[concurrency-interest] jsr166y.forkjoin API comments
David J. Biesack
David.Biesack at sas.com
Tue Jan 29 09:50:04 EST 2008
> Date: Mon, 28 Jan 2008 14:31:27 -0800
> From: "Joe Bowbeer" <joe.bowbeer at gmail.com>
> Cc: concurrency-interest at cs.oswego.edu
> On Jan 28, 2008 2:20 PM, Joe Bowbeer wrote:
> > On Jan 28, 2008 12:15 PM, David J. Biesack wrote:
> > >
> > > As can be seen with the Matrix Multiplication example, sometimes you want fork/join
> > > but you don't have an array to operate on; you just have a set of indices. In the example,
> > > I create a ParallelArray but don't use it; the data already exists in double arrays.
> > > Hence the internal allocation of the Object array is wasted.
> > >
> > > [ ... ]
> > >
> > > I don't know if there is a solution other than adding a new create() method which defers
> > > allocating the internal array until and only if it is needed (or maybe not at all, and it's a
> > > programming error to use the wrong factory if you really wish to replace/generate values.
> > >
> > There is a createEmpty method. Does it suffice?
> > --Joe
> On second thought, I'm fairly sure the answer is "no" -- though the
> doc is a little fuzzy. If no, I think a more descriptive name for
> createEmpty would result in less confusion.
correct, createEmpty is insufficient because it still preallocates
the array space. I think the name "createEmpty" is OK, though; the array is
empty (as per isEmpty); I would suggest renaming the int param
similar to java.util.ArrayList(int initialCapacity) and others.
David J. Biesack SAS Institute Inc.
(919) 531-7771 SAS Campus Drive
http://www.sas.com Cary, NC 27513
More information about the Concurrency-interest