-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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: various minor perf fixes for ledger postings #26775
Merged
Merged
Conversation
This file contains 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
ankush
added
backport version-13-hotfix
needs-tests
This PR needs automated unit-tests.
labels
Aug 2, 2021
ankush
commented
Aug 2, 2021
ankush
force-pushed
the
minor_perf_fixes
branch
2 times, most recently
from
August 6, 2021 10:09
0c06bdc
to
e966c43
Compare
- Order fields such that comparison will fail faster - Break out of loops if not matched
These are set only once fields
`select *` fetches all fields, output of this function is only used for comparing.
These properties don't change often, no need to query everytime.
ankush
force-pushed
the
minor_perf_fixes
branch
from
August 9, 2021 05:50
e966c43
to
966d643
Compare
Dropped a refactor that would require additional tests for now, will add in separate PR (in next release) |
ankush
requested review from
deepeshgarg007,
marination,
nextchamp-saqib and
rohitwaghchaure
as code owners
August 9, 2021 05:53
marination
approved these changes
Aug 10, 2021
Asset, POS and Attendance tests failing on other PRs as well. Not caused by this PR |
frappe-pr-bot
pushed a commit
to frappe-pr-bot/erpnext
that referenced
this pull request
Aug 11, 2021
* perf: only validate if voucher is journal entry * perf: optimize merge GLE - Order fields such that comparison will fail faster - Break out of loops if not matched * perf: don't try to match SLE if count mismatch * refactor: simplify initialize_previous_data * perf: use cache for fetching valuation_method These are set only once fields * refactor: simplify get_future_stock_vouchers * refactor: simplify get_voucherwise_gl_entries * perf: fetch only required fields for GL comparison `select *` fetches all fields, output of this function is only used for comparing. * perf: reorder conditions in PL cost center check * perf: reduce query while validating new gle * perf: use cache for validating warehouse props These properties don't change often, no need to query everytime. * perf: use cached stock settings to validate SLE * docs: update misleading docstring Co-authored-by: Marica <maricadsouza221197@gmail.com> (cherry picked from commit 9152715)
ankush
added a commit
that referenced
this pull request
Aug 11, 2021
* perf: only validate if voucher is journal entry * perf: optimize merge GLE - Order fields such that comparison will fail faster - Break out of loops if not matched * perf: don't try to match SLE if count mismatch * refactor: simplify initialize_previous_data * perf: use cache for fetching valuation_method These are set only once fields * refactor: simplify get_future_stock_vouchers * refactor: simplify get_voucherwise_gl_entries * perf: fetch only required fields for GL comparison `select *` fetches all fields, output of this function is only used for comparing. * perf: reorder conditions in PL cost center check * perf: reduce query while validating new gle * perf: use cache for validating warehouse props These properties don't change often, no need to query everytime. * perf: use cached stock settings to validate SLE * docs: update misleading docstring Co-authored-by: Marica <maricadsouza221197@gmail.com> (cherry picked from commit 9152715) Co-authored-by: Ankush <ankush@iwebnotes.com>
frappe-pr-bot
pushed a commit
to frappe-pr-bot/erpnext
that referenced
this pull request
Aug 11, 2021
* perf: only validate if voucher is journal entry * perf: optimize merge GLE - Order fields such that comparison will fail faster - Break out of loops if not matched * perf: don't try to match SLE if count mismatch * refactor: simplify initialize_previous_data * perf: use cache for fetching valuation_method These are set only once fields * refactor: simplify get_future_stock_vouchers * refactor: simplify get_voucherwise_gl_entries * perf: fetch only required fields for GL comparison `select *` fetches all fields, output of this function is only used for comparing. * perf: reorder conditions in PL cost center check * perf: reduce query while validating new gle * perf: use cache for validating warehouse props These properties don't change often, no need to query everytime. * perf: use cached stock settings to validate SLE * docs: update misleading docstring Co-authored-by: Marica <maricadsouza221197@gmail.com> (cherry picked from commit 9152715)
This was referenced Sep 1, 2021
asoral
pushed a commit
to asoral/erpnext
that referenced
this pull request
Nov 12, 2021
* perf: only validate if voucher is journal entry * perf: optimize merge GLE - Order fields such that comparison will fail faster - Break out of loops if not matched * perf: don't try to match SLE if count mismatch * refactor: simplify initialize_previous_data * perf: use cache for fetching valuation_method These are set only once fields * refactor: simplify get_future_stock_vouchers * refactor: simplify get_voucherwise_gl_entries * perf: fetch only required fields for GL comparison `select *` fetches all fields, output of this function is only used for comparing. * perf: reorder conditions in PL cost center check * perf: reduce query while validating new gle * perf: use cache for validating warehouse props These properties don't change often, no need to query everytime. * perf: use cached stock settings to validate SLE * docs: update misleading docstring Co-authored-by: Marica <maricadsouza221197@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
db.value_cache
for fetching details that won't change during a db transaction, this cache is dropped frequently whendb
instance dies, so it's safe to use.depends on frappe/frappe#13880
Outcome: Along with that ^ PR, ~20-25% saving in queries and time while submitting large documents with repeated validations. More stats in linked PR.
Note to reviewers: review commit by commit, would be easier that way.