Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1227

Performance Bug in ch.qos.logback.classic.spi.TurboFilterList

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.7, 1.1.8, 1.1.9
    • logback-classic
    • Any

    Description

      In getTurboFilterChainDecision() while iterating over all Turbo Filters java.util.concurrent.CopyOnWriteArrayList.toArray() is called which produces a copy of the whole under lying ArrayList.

      If this happens for every log request a lot of unnecessary objects are created which also then need to be garbage collected. This is not at all "turbo"...

      The right implementation is in the code itself in a comment in line 58

                  // for (TurboFilter tf : this) {
      

      There seems to me no sane reason to not use the commented line but create a copy of the underlying array list every time. The inherited class takes care of current writes by copying on every write hence there is no need to copy on every read.

      If only one turbo filter is configured this bug does not occur.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            paulBouche Paul Bouche
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: