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

remove InverseLookup, not useful #400

Closed
wants to merge 1 commit into from

Conversation

MichaelRawson
Copy link
Contributor

InverseLookup is only used to find the location of a particular literal within a clause. I could not find a case where this is faster than linear search, particularly as clauses are typically relatively short and linear scan for words is fast on most platforms. Suggestions for test cases where this does have a performance impact welcome.

@quickbeam123
Copy link
Collaborator

Hi Michael, what kind of tests did you run check there is no impact?

@MichaelRawson
Copy link
Contributor Author

Hi Martin, I'll admit to going a little "on feel" with this one. Performing a hashtable lookup has a very high constant factor compared to a very tight loop. I tried a couple hundred problems with a shell script and couldn't find a reproducible difference, but that's not to say that there isn't one - for there to be a difference we'd need very large clauses, I'd expect hundreds or thousands of literals at least.

@selig
Copy link
Contributor

selig commented Aug 23, 2022

Clauses can get very very long (definitely hundreds of literals, maybe thousands). Perahps not a common case but it is a case that we care about as those are hard problems.

Do we have a good way of searching statistics of solved problems? Ideally here we'd do a run to record max clause length and use this to select a subset of problems to do some performance checks on.

Of course, it's likely that the best solution is to use linear search for short clauses and inverse lookup for long clauses!

@MichaelRawson
Copy link
Contributor Author

Performance testing inconclusive, to my surprise. Let's shelve this for now.

@MichaelRawson MichaelRawson deleted the michael-remove-inverse-lookup branch July 12, 2023 15:51
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