[HARMONY-6362] Logging performance improvements - ASF JIRA (original) (raw)

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:

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