Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-495

Metadata constructor is slow

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.8
    • Component/s: metadata
    • Labels:
      None

      Description

      Metadata constructor initialises a bunch of SimpleTimeFormat objects. This is slow - they need to parse their configuration strings, system must be queried for timezone, and so on. In my simple test in which I create new Metadata object for each new document this accounts for approximately 25-30% of all time spent in Tika.

      As pointed out by Nick Burch, SimpleTimeFormat is not threadsafe, so they can't be static.

      Possible solutions include using org.apache.commons.lang.time.FastDateFormat instead (if its features are sufficient), or using thread local objects.

        Attachments

        1. TIKA-495.patch
          6 kB
          Jukka Zitting

          Activity

            People

            • Assignee:
              jukkaz Jukka Zitting
              Reporter:
              syskin Radek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: