[slf4j-dev] [Bug 239] New: performance issue in MessageFormatter

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Sun Sep 4 23:05:06 CEST 2011


http://bugzilla.slf4j.org/show_bug.cgi?id=239

           Summary: performance issue in MessageFormatter
           Product: SLF4J
           Version: 1.6.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Core API
        AssignedTo: slf4j-dev at qos.ch
        ReportedBy: kite668 at mail.ru


1. org.slf4j.helpers.MessageFormatter.arrayFormat uses localy thread-safe
StringBuffer instead of StringBuilder. I think it can be safely replaced.

2. "deeplyAppendParameter(sbuf, argArray[L], new HashMap());" - this is called
for EVERY argument, even if it isn't array. I think instance of HashMap
shouldn't be created for every argument. You can pass null and initialize
HashMap in deeplyAppendParameter only for object's arrays and if it's previous
value is null. Also you can initialize this map with initial capacity = array's
size.

3. It will be very good if method arrayFormat would receive StringBuilder
instead of creating instance of result String. This is common and more fast
solution.

-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list