You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Grant Ingersoll (Jira)" <ji...@apache.org> on 2026/07/27 19:44:00 UTC
[jira] [Updated] (TIKA-4796) Caching of MagicDetector pattern compilations
[ https://issues.apache.org/jira/browse/TIKA-4796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Grant Ingersoll updated TIKA-4796:
----------------------------------
Description:
I've been doing some profiling of Tika as part of a broader focus on a document extraction pipeline and one of the areas that shows up more than expected and appears to be an easy fix is the
{code:java}
Pattern p = Pattern.compile(new String(this.pattern, UTF_8), flags);{code}
line in `matchesBuffer` (trunk/main) and the `detect` method in the 3.x line.
The fix is to compile the pattern in the initialization. Patch/fix coming shortly.
was:
I've been doing some profiling of Tika as part of a broader focus on a document extraction pipeline and one of the areas that shows up more than expected and appears to be an easy fix is the
```
Pattern p = Pattern.compile(new String(this.pattern, UTF_8), flags);
```
line in `matchesBuffer` (trunk/main) and the `detect` method in the 3.x line.
The fix is to compile the pattern in the initialization. Patch/fix coming shortly.
> Caching of MagicDetector pattern compilations
> ---------------------------------------------
>
> Key: TIKA-4796
> URL: https://issues.apache.org/jira/browse/TIKA-4796
> Project: Tika
> Issue Type: Improvement
> Reporter: Grant Ingersoll
> Priority: Major
>
> I've been doing some profiling of Tika as part of a broader focus on a document extraction pipeline and one of the areas that shows up more than expected and appears to be an easy fix is the
> {code:java}
> Pattern p = Pattern.compile(new String(this.pattern, UTF_8), flags);{code}
> line in `matchesBuffer` (trunk/main) and the `detect` method in the 3.x line.
>
> The fix is to compile the pattern in the initialization. Patch/fix coming shortly.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)