Activity

I've had a partial patch for this issue in my sandbox for a while. Attaching it here so that it won't be lost. The patch replaces four Vectors with ArrayLists. More investegation is needed in order to find out whether these changes are safe. FWIW, derbyall and the JUnit tests ran cleanly on Solaris 10 and Sun Java SE 5.0 with this patch.

removeActivation() contains some code which is not as easily expressed with ArrayList as with Vector, since ArrayList doesn't have an equivalent to Vector.capacity().

int capacity = acts.capacity();

if (capacity > 20 && (capacity > 2 * acts.size()))

{
acts.trimToSize();
}

This optimization might save space in some cases, but it doesn't seem like a very important optimization (I believe it is even less important now that DERBY-418 is fixed), so I just commented it out in the patch for now. If one really wants this optimization, it should be fairly easy to implement it by keeping track of the largest observed value of acts.size() in addActivation() and use that value instead of acts.capacity() in removeActivation().

But first we need to find out whether it is safe to remove the synchronization...

Knut Anders Hatlen
added a comment - 15/Dec/06 14:49 I've had a partial patch for this issue in my sandbox for a while. Attaching it here so that it won't be lost. The patch replaces four Vectors with ArrayLists. More investegation is needed in order to find out whether these changes are safe. FWIW, derbyall and the JUnit tests ran cleanly on Solaris 10 and Sun Java SE 5.0 with this patch.
removeActivation() contains some code which is not as easily expressed with ArrayList as with Vector, since ArrayList doesn't have an equivalent to Vector.capacity().
int capacity = acts.capacity();
if (capacity > 20 && (capacity > 2 * acts.size()))
{
acts.trimToSize();
}
This optimization might save space in some cases, but it doesn't seem like a very important optimization (I believe it is even less important now that DERBY-418 is fixed), so I just commented it out in the patch for now. If one really wants this optimization, it should be fairly easy to implement it by keeping track of the largest observed value of acts.size() in addActivation() and use that value instead of acts.capacity() in removeActivation().
But first we need to find out whether it is safe to remove the synchronization...

I have uploaded a new version of the patch (1b) which preserves the
space optimization which previously was implemented with
Vector.capacity() and Vector.trimToSize(). I have not found any way to
manipulate the Vectors without having synchronized on the connection
first, so I believe it is safe to replace them with vectors.

Derbyall and JUnit tests ran cleanly on the updated patch. Reviews
would be appreciated. Thanks!

Knut Anders Hatlen
added a comment - 10/Jan/07 14:49 I have uploaded a new version of the patch (1b) which preserves the
space optimization which previously was implemented with
Vector.capacity() and Vector.trimToSize(). I have not found any way to
manipulate the Vectors without having synchronized on the connection
first, so I believe it is safe to replace them with vectors.
Derbyall and JUnit tests ran cleanly on the updated patch. Reviews
would be appreciated. Thanks!

Attached another patch (2a) which removes the rest of the synchronized containers (two Hashtables) in GenericLCC. Also touched a couple of other files because the signature of copyHashtableToAIHT() was changed. Please review!

Knut Anders Hatlen
added a comment - 11/Jan/07 13:57 Attached another patch (2a) which removes the rest of the synchronized containers (two Hashtables) in GenericLCC. Also touched a couple of other files because the signature of copyHashtableToAIHT() was changed. Please review!