harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Wilson (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6362) Logging performance improvements
Date Mon, 26 Oct 2009 20:33:02 GMT
Logging performance improvements
--------------------------------

                 Key: HARMONY-6362
                 URL: https://issues.apache.org/jira/browse/HARMONY-6362
             Project: Harmony
          Issue Type: Improvement
          Components: Classlib
         Environment: SVN Revision: 829932
            Reporter: Jesse Wilson
            Priority: Minor


The logging module performs more synchronization and object allocation than necessary. In
particular, getHandlers() always needs synchronization and creates an array. By adopting util.concurrent
features (CopyOnWriteArrayList) and coding to the common case (when there are zero handlers)
I saw a 2.5x improvement in throughput for calls to logger.log(Level, String). In a benchmark
that measures calls to "logger.info", call time improved from 385000ns to 154000ns per message.

Here's an overview of the patch:
 - Reduce the use of synchronization by adopting a CopyOnWriteArrayList for Handlers
 - Reduce object creation by reusing a 0-length handlers array in getHandlers()
 - Load handlers on logger creation rather than on receipt of the first message. This also
fixes a behavioural inconsistency with the RI. I've got a test case that demonstrates this.
 - Cleanup synchronization by moving methods with "synchronized (LogManager.getManager())"
blocks to the LogManager class

I've got the patch ready to submit upstream. I'll submit it when my commit privileges are
granted, unless anyone raises objections here.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message