Hi Thomas,
I'm forking/joining like this:
protected Summary compute()
{
int length = end - start;
if (length <= THRESHOLD)
return sequentialIterator.iterateSequentially(start, end);
RegressionRecurser<DataPoint, Summary> leftTask = new RegressionRecurser<DataPoint, Summary>(data, start, start + length/2, sequentialIterator);
leftTask.fork();
RegressionRecurser<DataPoint, Summary> rightTask = new RegressionRecurser<DataPoint, Summary>(data, start + length/2, end, sequentialIterator);
Summary rightResult = rightTask.compute();
Summary leftResult = leftTask.join();
leftResult.merge(rightResult);
return leftResult;
}
I.e. I'm using indexes into the ArrayList directly. Conceptually it would be nicer to use an immutable SubList provided such can be provided without copying elements - as I don't need to update the SubLists just iterate over them. I can do that efficiently with ArrayList but not with GapList.
Your IList implementation of doGetAll creates a new IList by copying elements - hence, reducing performance gains of GapList.
This is opposed to ArrayList that does NOT create a SubList by copying elements but just creates an imutable SubList that refers to the original underlying array.
Hence, my request: that GapList would provide a getSubList that would create a imutable SubList without copying elements but just refering to the underlying array. In order to optimize SubList performance the immutable SubLists could even be created without any gap.
Obviously I could use GapList with indexes directly as I do now with ArrayList. But, as said I find the SubList approach conceptually more correct, transparent, and general. And hence worth supporting directly in with GapList.getSubList(0, list.size()/2).
Hope this clarifies my thoughts.
Regards & thanks
Henrik