Skip to content

Parallelize word processing in suggest command#63

Open
snomos wants to merge 1 commit into
mainfrom
parallelize-suggest
Open

Parallelize word processing in suggest command#63
snomos wants to merge 1 commit into
mainfrom
parallelize-suggest

Conversation

@snomos
Copy link
Copy Markdown
Member

@snomos snomos commented Apr 2, 2026

Use par_iter() from Rayon instead of a sequential for-loop when processing words in the suggest command, matching the approach already used in the accuracy command.

This gives a significant speedup when processing large word lists via stdin, e.g.:

divvunspell suggest -a tools/spellcheckers/se.zhfst < test.txt > test.ut.txt

Changes:

  • Made rayon a required (non-optional) dependency for the CLI
  • Changed the run() function to use par_iter().map().collect() for parallel processing
  • Updated the speller trait bound to Send + Sync to allow sharing across threads
  • Results are collected and written sequentially to preserve output order

Use par_iter() instead of a sequential for-loop when processing words
in the suggest command, matching the approach used in the accuracy
command. This gives a significant speedup when processing large word
lists via stdin.
@snomos snomos requested a review from bbqsrc April 2, 2026 06:19
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.

1 participant