db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-2150) Reduce use of synchronized collections in GenericLanguageConnectionContext
Date Fri, 15 Dec 2006 14:50:21 GMT
     [ http://issues.apache.org/jira/browse/DERBY-2150?page=all ]

Knut Anders Hatlen updated DERBY-2150:
--------------------------------------

    Attachment: derby-2150-1a.diff

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...

> Reduce use of synchronized collections in GenericLanguageConnectionContext
> --------------------------------------------------------------------------
>
>                 Key: DERBY-2150
>                 URL: http://issues.apache.org/jira/browse/DERBY-2150
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL, Performance
>    Affects Versions: 10.3.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-2150-1a.diff
>
>
> In org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext, it is probably safe
to replace some of the synchronized collections with unsynchronized ones. This should be investigated,
and the unnecessary synchronization should be removed. See discussion here: http://www.nabble.com/Use-of-synchronized-containers-in-engine-code-tf2754469.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message