Repository navigation
Switch text dict runtime backend from Marisa to Darts - #1376
Merged
Merged
Conversation
When loading a .txt-format dict (from zip or filesystem), build a DartsDict in-memory instead of a MarisaDict. Darts trie construction and prefix-match queries are both faster than MARISA's for this workload. Benchmark (1 MB corpus, -c opt, ZipResourceProvider; init measured at 100 KB): format s2t (M/s) s2twp (M/s) s2t init (ms) s2twp init (ms) txt (before) 22 8.2 ~46 ~50 txt (after) 33 10.0 25 30 ocd2 (marisa) 22 8.3 17 23 ocd (darts) 32 9.9 11 16 txt throughput after the change matches pre-built ocd; init time drops by roughly half. ocd2 is now the only format without a Darts-speed conversion path. Also adds src/tools/SpeedBenchmark.cpp (with --resource-zip support) as a Bazel build target for future benchmarking.
frankslin
force-pushed
the
upstream-master
branch
from
July 1, 2026 06:34
daaef4a to
e415bbd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When loading a .txt-format dict (from zip or filesystem), build a DartsDict in-memory instead of a MarisaDict. Darts trie construction and prefix-match queries are both faster than MARISA's for this workload.
Benchmark (1 MB corpus, -c opt, ZipResourceProvider; init measured at 100 KB):
txt throughput after the change matches pre-built ocd; init time drops by roughly half. ocd2 is now the only format without a Darts-speed conversion path.
Also adds src/tools/SpeedBenchmark.cpp (with --resource-zip support) as a Bazel build target for future benchmarking.