lt-trim: new option --match-section #165
Merged
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.
May be given multiple times. Any section matching such a
name (id@type) in the analyser will only be trimmed against sections
with the same name in the bidix. Useful for regex sections, which tend
to have a very different structure from regular entries (few states
with lots of transitions + loops) – leading to slowdown when
intersecting.
This gives a 4x speedup (60s → 15s) on nob→nno:
BEFORE:
$ \time lttoolbox/lttoolbox/lt-trim apertium-nob/nob.automorf.bin apertium-nno-nob/nob-nno.autobil.bin /tmp/before.bin final@inconditional 26 76 main@standard 168643 350041 regex@standard 403 7475 58.73user 0.97system 1:00.45elapsed 98%CPU (0avgtext+0avgdata 2280784maxresident)k 0inputs+3288outputs (0major+574892minor)pagefaults 0swaps
AFTER:
$ \time lttoolbox/lttoolbox/lt-trim --match-section=regex@standard apertium-nob/nob.automorf.bin apertium-nno-nob/nob-nno.autobil.bin /tmp/after.bin Matched sections regex@standard final@inconditional 26 76 main@standard 168643 350041 regex@standard 389 7405 14.36user 0.24system 0:14.77elapsed 98%CPU (0avgtext+0avgdata 382136maxresident)k 0inputs+3288outputs (0major+102452minor)pagefaults 0swaps
(timings are the same if lt-comp -j was used to make nob.automorf.bin)