perf: various minor perf fixes for ledger postings#26775
Merged
marination merged 15 commits intofrappe:developfrom Aug 11, 2021
Merged
perf: various minor perf fixes for ledger postings#26775marination merged 15 commits intofrappe:developfrom
marination merged 15 commits intofrappe:developfrom
Conversation
ankush
commented
Aug 2, 2021
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.
e966c43 to
966d643
Compare
Member
Author
|
Dropped a refactor that would require additional tests for now, will add in separate PR (in next release) |
marination
approved these changes
Aug 10, 2021
Collaborator
|
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>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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_cachefor fetching details that won't change during a db transaction, this cache is dropped frequently whendbinstance 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.