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

increase starting size of ast's hash table to 512k entries #5040

Merged
merged 1 commit into from
Mar 2, 2021
Merged

increase starting size of ast's hash table to 512k entries #5040

merged 1 commit into from
Mar 2, 2021

Conversation

nunoplopes
Copy link
Collaborator

Z3's AST hash table is quite slow and has a lot of collisions. Instead of increasing the hash table, Z3 keeps pouring entries into long chains for collision'ed keys.

Increasing the initial size of this hash table helps a lot for larger formulas.

Here's the dramatic before and after when running just vcgen for a few Alive2 benchmarks:

z3 hash

sqlite3 goes from 5.5 hours to < 1 hour! 😁

The number of collisions is still in O(crazy). There are other uses of chashtable that need investigation.
Another thing is that on expansion, collision lists get flipped, which is then terrible for deletion as expressions are deleted in LIFO order. So flipping the collisions lists triggers a quadratic factor in the number of the lists' sizes.
I've a patch that avoids flipping, but that needs further testing.

@nunoplopes
Copy link
Collaborator Author

CC @regehr @aqjune
(this is why sometimes a small change in vcgen led to huge regressions. they just caused collisions+odd number of expansions of the hash table)

@regehr
Copy link
Contributor

regehr commented Feb 19, 2021

wow, I had no idea this could even be a problem

@NikolajBjorner NikolajBjorner merged commit 4c9fed2 into Z3Prover:master Mar 2, 2021
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 24, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 3, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 3, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 3, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 4, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 4, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 4, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 6, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 6, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 22, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 22, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 22, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 22, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 22, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 23, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 23, 2022
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 24, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 25, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 25, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Sep 25, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 27, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 27, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 27, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 28, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 1, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 3, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 3, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 3, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 3, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 4, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 4, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this pull request Jul 4, 2024
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