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

perf: don't query unless required #26175

Merged
merged 1 commit into from
Jun 24, 2021
Merged

Conversation

ankush
Copy link
Member

@ankush ankush commented Jun 23, 2021

Reordering conditionals so queries are not performed unless absolutely required.

Essentially, both options below are semantically the same but one will always hit the DB before evaluating to False.

  • False and frappe.db.sql("select * from tabItem")

  • frappe.db.sql("select * from tabItem") and False

@ankush ankush marked this pull request as draft June 23, 2021 15:48
@ankush ankush force-pushed the perf_cache_invariants branch 2 times, most recently from 7d4139e to 3e9212c Compare June 23, 2021 15:56
@ankush ankush changed the title perf: don't query unless required, and use cache perf: don't query unless required Jun 24, 2021
re-order conditionals so queries are no evaluated, unless required.
@ankush ankush marked this pull request as ready for review June 24, 2021 14:58
@ankush ankush merged commit 2ea750e into frappe:develop Jun 24, 2021
ankush added a commit to ankush/erpnext that referenced this pull request Jun 24, 2021
re-order conditionals so queries are not evaluated unless required.
# Conflicts:
#	erpnext/stock/doctype/batch/batch.py
ankush added a commit that referenced this pull request Jun 24, 2021
re-order conditionals so queries are not evaluated unless required.
# Conflicts:
#	erpnext/stock/doctype/batch/batch.py
asoral pushed a commit to asoral/erpnext that referenced this pull request Nov 12, 2021
re-order conditionals so queries are not evaluated unless required.
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