Skip to content

TIKA-4875: improve tika-eval performance - #3123

Merged
tballison merged 5 commits into
mainfrom
TIKA-4875
Sep 3, 2026
Merged

TIKA-4875: improve tika-eval performance#3123
tballison merged 5 commits into
mainfrom
TIKA-4875

Conversation

@tballison

Copy link
Copy Markdown
Contributor

Thanks for your contribution to Apache Tika! Your help is appreciated!

Before opening the pull request, please verify that

  • there is an open issue on the Tika issue tracker which describes the problem or the improvement. We cannot accept pull requests without an issue because the change wouldn't be listed in the release notes.
  • the issue ID (TIKA-XXXX)
    • is referenced in the title of the pull request
    • and placed in front of your commit messages surrounded by square brackets ([TIKA-XXXX] Issue or pull request title)
  • commits are squashed into a single one (or few commits for larger changes)
  • Tika builds and unit tests pass with ./mvnw clean install (clean test alone cannot resolve the pipes plugin zips)
  • if you used a generative AI tool: follow the ASF Generative Tooling Guidance (Generated-by: <tool> in the commit message), and consider running the pre-flight in .skills/devs/pr-review/SKILL.md — fix what it finds; don't paste its report here
  • there should be no conflicts when merging the pull request branch into the recent main branch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulled main branch
  • if you add new module that downstream users will depend upon add it to relevant group in tika-bom/pom.xml.

We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the Tika mailing list. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new randomized equivalence test is non-deterministic and the new default H2 cache sizing should be configurable to avoid unexpected memory impact in constrained environments.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR targets performance improvements in tika-eval runs by reducing preprocessing overhead in langdetect/junkdetect feature extraction, and by tuning reporting and database defaults to better surface and sustain throughput.

Changes:

  • Replace URL/email stripping regex passes in CharSoupFeatureExtractor with single-pass ASCII scanners (while aiming to preserve identical output).
  • Improve tika-eval progress logging by adding a “last interval” docs/sec rate alongside the cumulative average.
  • Tune the default H2 JDBC URL used by tika-eval Profile/Compare and document the changes in CHANGES.txt.
File summaries
File Description
tika-langdetect/tika-langdetect-opennlp/src/main/java/org/apache/tika/langdetect/opennlp/OpenNLPDetector.java Makes bounded URL/mail regex quantifiers possessive for normalization performance while preserving matches.
tika-langdetect/tika-langdetect-charsoup-core/src/main/java/org/apache/tika/langdetect/charsoup/core/CharSoupFeatureExtractor.java Replaces URL/email regex stripping with hand-rolled scanners to avoid regex overhead.
tika-langdetect/tika-langdetect-charsoup/src/test/java/org/apache/tika/langdetect/charsoup/core/CharSoupFeatureExtractorTest.java Adds an equivalence test comparing scanner output vs regex reference behavior.
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/StatusReporter.java Adds windowed (last-interval) rate reporting.
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfileRunner.java Adjusts default H2 JDBC URL parameters (retention/cache).
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparerRunner.java Adjusts default H2 JDBC URL parameters (retention/cache).
CHANGES.txt Notes the performance changes and user-visible logging/db default updates.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +184 to +187
//default to h2
Path p = Paths.get(dbPath);
return "jdbc:h2:file:" + p.toAbsolutePath();

// drop the 45s MVStore chunk retention (bloat + growing compaction cost); CACHE_SIZE is KB
return "jdbc:h2:file:" + p.toAbsolutePath() + ";RETENTION_TIME=0;CACHE_SIZE=1048576";
Comment on lines +125 to +128
//default to h2
Path p = Paths.get(dbPath);
return "jdbc:h2:file:" + p.toAbsolutePath();

// drop the 45s MVStore chunk retention (bloat + growing compaction cost); CACHE_SIZE is KB
return "jdbc:h2:file:" + p.toAbsolutePath() + ";RETENTION_TIME=0;CACHE_SIZE=1048576";
Comment on lines +151 to +152
long seed = new Random().nextLong();
Random random = new Random(seed);
@tballison
tballison merged commit 4f0e11b into main Sep 3, 2026
4 checks passed
@tballison
tballison deleted the TIKA-4875 branch September 3, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants