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

Use short-circuit evaluation in AndQuery and OrQuery (fix #4145) #4147

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

jcassette
Copy link
Contributor

@jcassette jcassette commented Nov 16, 2021

Description

This improves the performance of dbcore.AndQuery.match and dbcore.OrQuery.match.
They would evaluate all queries and construct a list of all query results and then pass that list to all / any.
This modification passes a generator to all / any, which allows to stop querying at the first false / true result (short-circuit evaluation).
I guess we could also code the whole loops so that we do not run into the same issue accidentally.

Fixes #4145
Related to #2388 ?

To Do

  • Documentation: not applicable
  • Changelog.
  • Tests: I did not find any test case related to query behavior...

@sampsyo
Copy link
Member

sampsyo commented Nov 17, 2021

Wow; what an elegant fix! It's nice that any does this already for generators. 😃 Looks just perfect.

@sampsyo sampsyo merged commit 281eec8 into beetbox:master Nov 17, 2021
@jcassette jcassette deleted the query-perf branch November 17, 2021 14: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.

Import is slow with inline field in aunique
2 participants