-
Notifications
You must be signed in to change notification settings - Fork 88
Eliminate exception-based hashtable lookups in solver hot paths #1976
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
Draft
Copilot
wants to merge
6
commits into
master
Choose a base branch
from
copilot/audit-performance-bottlenecks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e4a9fa7
Initial plan
Copilot 78f39e1
Replace try/Not_found with find_default in solvers; use List.concat_m…
Copilot 9782831
Also replace try/Not_found with find_default in sLR.ml
Copilot c001b0f
Revert find_default to try/Not_found where default is S.Dom.bot()
Copilot 15ae6b3
Revert List.concat_map change in vendor/ppx_easy_deriving/pat_exp.ml
Copilot ca2e46a
Define find_default_delayed helper and replace S.Dom.bot() try/Not_fo…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
|
michael-schwarz marked this conversation as resolved.
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another catch with ones like this: this now always calls
bot (), whereas previously it was only called when actually necessary.There's a reason why Batteries has some
*_delayedfunctions for some things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot See if batteries has something like this and if it does use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batteries'
Hashtbl.Sdoes not have afind_default_delayed(or equivalent lazy) variant. Thefind_defaultusages withS.Dom.bot ()have been reverted totry HM.find ... with Not_found -> S.Dom.bot ()to preserve the lazy evaluation semantics. TheVS.emptycases remain asfind_defaultsinceVS.emptyis a constant (commit c001b0f).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot: As there are so many of these, define a helper function
find_default_delayedfromfind_optandBatOption.default_delayedand use that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit ca2e46a. Added
find_default_delayed h k f = Option.default_delayed f (HM.find_option h k)to each affected solver module and replaced alltry HM.find ... with Not_found -> S.Dom.bot ()patterns (9 total acrosstd3.ml,topDown.ml,topDown_term.ml,topDown_space_cache_term.ml). IntopDown.mlthe helper is defined overHPM(the pair hashtable) since the singleS.Dom.bot ()case there uses that table.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should just be in
GobHashtbl.It might require some interface changes, so it might be easier to benchmark this first and then clean up if it turns out to be beneficial.