Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUCENE-9983: Stop sorting determinize powersets unnecessarily #162

Closed
wants to merge 1 commit into from

Conversation

zhaih
Copy link
Contributor

@zhaih zhaih commented May 31, 2021

Description

In determinize function (which truns NFA to DFA), we use SortedIntSet to store powerset and it uses a sorted data structure which could be very costly in some cases. And we actually don't need the sorting functionality.

Solution

Replace usage of SortedIntSet by StateSet, a wrapper of IntIntHashMap. Note I haven't removed SortedIntSet but probably we should since it is only used in determinize?

Tests

  • Reused old tests that used to test SortedIntSet
  • I also applied the patch attached in LUCENE-9981. Before the commit it runs 6min before throw an exception and after patch it is 1+ sec. (Seems from the error message this has something to do with the order we iterate the key, but I believe it still provides some speedups)

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Lucene maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.

Replace usage of SortedIntSet by StateSet, a wrapper of IntIntHashMap
@zhaih zhaih closed this May 31, 2021
@zhaih
Copy link
Contributor Author

zhaih commented May 31, 2021

Close this one temporarily for debugging

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.

None yet

1 participant