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: production plan submission #39846

Merged
merged 1 commit into from
Feb 12, 2024
Merged

perf: production plan submission #39846

merged 1 commit into from
Feb 12, 2024

Conversation

s-aga-r
Copy link
Contributor

@s-aga-r s-aga-r commented Feb 11, 2024

156.526s -> 15.199s

Before:

34086815 function calls (33610353 primitive calls) in 156.526 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    128/1    0.000    0.000  156.526  156.526 {built-in method builtins.exec}
        1    0.000    0.000  156.526  156.526 <string>:1(<module>)
        1    0.005    0.005  156.526  156.526 production_plan.py:492(update_bin_qty)
      613    0.007    0.000  153.748    0.251 bin.py:30(update_reserved_qty_for_production_plan)
     4906    0.028    0.000  151.640    0.031 utils.py:84(execute_query)
      613    0.071    0.000  150.262    0.245 production_plan.py:1651(get_reserved_qty_for_production_plan)
     4906    0.043    0.000  149.184    0.030 database.py:160(sql)
     4906    0.008    0.000  148.524    0.030 cursors.py:138(execute)
     4906    0.009    0.000  148.054    0.030 cursors.py:322(_query)
     4906    0.014    0.000  148.030    0.030 connections.py:543(query)
     4906    0.009    0.000  147.881    0.030 connections.py:767(_read_query_result)
     4906    0.011    0.000  147.865    0.030 connections.py:1155(read)
   830013    1.719    0.000  143.697    0.000 connections.py:687(_read_packet)
  1660026    1.349    0.000  140.592    0.000 connections.py:732(_read_bytes)
  1660155    0.348    0.000  138.193    0.000 {method 'read' of '_io.BufferedReader' objects}
    22710  138.138    0.006  138.138    0.006 {method 'recv_into' of '_socket.socket' objects}
     6758    0.012    0.000  137.845    0.020 socket.py:691(readinto)
      613    0.057    0.000   59.210    0.097 production_plan.py:1694(get_non_completed_production_plans)
     3680    0.009    0.000   21.651    0.006 connections.py:1237(_read_result_packet)
     3680    0.796    0.000   20.079    0.005 connections.py:1270(_read_rowdata_packet)
     1839    0.009    0.000    4.143    0.002 __init__.py:1168(get_doc)
     1839    0.007    0.000    3.742    0.002 document.py:26(get_doc)
     1839    0.008    0.000    3.713    0.002 document.py:83(__init__)
     1839    0.015    0.000    3.705    0.002 document.py:130(load_from_db)
     1840    0.004    0.000    3.595    0.002 database.py:515(get_value)
     1840    0.009    0.000    3.591    0.002 database.py:585(get_values)
     1840    0.010    0.000    3.582    0.002 database.py:851(_get_values_from_table)
     1226    0.022    0.000    3.474    0.003 document.py:1121(db_set)
   760735    0.869    0.000    2.636    0.000 connections.py:1283(_read_row_from_packet)
      613    0.020    0.000    2.415    0.004 work_order.py:1527(get_reserved_qty_for_production)
     4906    0.029    0.000    2.401    0.000 utils.py:107(prepare_query)
     4906    0.017    0.000    2.348    0.000 dialects.py:129(get_sql)
     4906    0.062    0.000    2.317    0.000 queries.py:1218(get_sql)
26530/19776    0.049    0.000    2.279    0.000 {method 'join' of 'str' objects}
  1156139    0.603    0.000    2.055    0.000 protocol.py:165(read_length_coded_string)
     4906    0.012    0.000    2.001    0.000 queries.py:1451(_where_sql)
7357/2453    0.035    0.000    1.934    0.001 terms.py:970(get_sql)
     2452    0.011    0.000    1.740    0.001 terms.py:815(get_sql)
     2452    0.007    0.000    1.712    0.001 terms.py:622(get_sql)
   177770    0.203    0.000    1.673    0.000 terms.py:623(<genexpr>)
   186968    0.670    0.000    1.594    0.000 terms.py:46(get_sql)
     3680    0.139    0.000    1.558    0.000 connections.py:1302(_get_descriptions)
      613    0.002    0.000    1.483    0.002 document.py:1041(load_doc_before_save)
      613    0.001    0.000    1.388    0.002 utils.py:240(get_or_make_bin)
      613    0.001    0.000    1.387    0.002 __init__.py:1150(get_cached_value)
      613    0.002    0.000    1.385    0.002 __init__.py:1075(get_cached_doc)
    27595    0.048    0.000    1.169    0.000 utils.py:48(_copy)
     1226    0.015    0.000    1.162    0.001 database.py:913(set_value)
     3067    0.012    0.000    1.146    0.000 utils.py:58(get_query)
     3067    0.034    0.000    1.134    0.000 query.py:34(get_query)
  1680884    0.936    0.000    0.936    0.000 {method 'settimeout' of '_socket.socket' objects}
     7976    0.028    0.000    0.933    0.000 client.py:894(execute_command)

After:

15978916 function calls (15553847 primitive calls) in 15.199 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    128/1    0.000    0.000   15.199   15.199 {built-in method builtins.exec}
        1    0.000    0.000   15.199   15.199 <string>:1(<module>)
        1    0.004    0.004   15.199   15.199 production_plan.py:492(update_bin_qty)
      613    0.005    0.000   12.453    0.020 bin.py:30(update_reserved_qty_for_production_plan)
     4294    0.024    0.000   11.073    0.003 utils.py:84(execute_query)
      613    0.028    0.000    9.131    0.015 production_plan.py:1651(get_reserved_qty_for_production_plan)
     4294    0.035    0.000    8.735    0.002 database.py:160(sql)
     4294    0.007    0.000    8.479    0.002 cursors.py:138(execute)
     4294    0.008    0.000    8.026    0.002 cursors.py:322(_query)
     4294    0.012    0.000    8.005    0.002 connections.py:543(query)
     4294    0.008    0.000    7.879    0.002 connections.py:767(_read_query_result)
     4294    0.009    0.000    7.867    0.002 connections.py:1155(read)
    70038    0.173    0.000    7.294    0.000 connections.py:687(_read_packet)
   140076    0.128    0.000    6.181    0.000 connections.py:732(_read_bytes)
    20246    6.166    0.000    6.166    0.000 {method 'recv_into' of '_socket.socket' objects}
   140205    0.047    0.000    5.957    0.000 {method 'read' of '_io.BufferedReader' objects}
     4294    0.007    0.000    5.910    0.001 socket.py:691(readinto)
     1839    0.008    0.000    4.042    0.002 __init__.py:1168(get_doc)
     3678    0.016    0.000    3.774    0.001 caching.py:42(wrapper)
      613    0.019    0.000    3.678    0.006 work_order.py:1527(get_reserved_qty_for_production)
     1839    0.006    0.000    3.674    0.002 document.py:26(get_doc)
     1839    0.008    0.000    3.645    0.002 document.py:83(__init__)
     1839    0.014    0.000    3.637    0.002 document.py:130(load_from_db)
     1840    0.003    0.000    3.530    0.002 database.py:515(get_value)
     1840    0.008    0.000    3.526    0.002 database.py:585(get_values)
     1840    0.009    0.000    3.517    0.002 database.py:851(_get_values_from_table)
     1226    0.020    0.000    3.311    0.003 document.py:1121(db_set)
     4294    0.024    0.000    2.291    0.001 utils.py:107(prepare_query)
     4294    0.014    0.000    2.247    0.001 dialects.py:129(get_sql)
24082/17328    0.047    0.000    2.231    0.000 {method 'join' of 'str' objects}
     4294    0.053    0.000    2.220    0.001 queries.py:1218(get_sql)
     4294    0.011    0.000    1.951    0.000 queries.py:1451(_where_sql)
6133/1841    0.029    0.000    1.886    0.001 terms.py:970(get_sql)
     3068    0.005    0.000    1.866    0.001 connections.py:1237(_read_result_packet)
     1840    0.009    0.000    1.724    0.001 terms.py:815(get_sql)
     1840    0.005    0.000    1.703    0.001 terms.py:622(get_sql)
   175934    0.203    0.000    1.667    0.000 terms.py:623(<genexpr>)
   185132    0.666    0.000    1.580    0.000 terms.py:46(get_sql)
     3068    0.135    0.000    1.518    0.000 connections.py:1302(_get_descriptions)
      613    0.002    0.000    1.409    0.002 document.py:1041(load_doc_before_save)
      613    0.001    0.000    1.371    0.002 utils.py:240(get_or_make_bin)
      613    0.001    0.000    1.369    0.002 __init__.py:1150(get_cached_value)
      613    0.002    0.000    1.367    0.002 __init__.py:1075(get_cached_doc)
     3067    0.012    0.000    1.131    0.000 utils.py:58(get_query)
     3067    0.033    0.000    1.119    0.000 query.py:34(get_query)
     1226    0.015    0.000    1.112    0.001 database.py:913(set_value)
    24536    0.042    0.000    1.040    0.000 utils.py:48(_copy)
    56400    0.037    0.000    0.903    0.000 protocol.py:234(__init__)
     7976    0.027    0.000    0.868    0.000 client.py:894(execute_command)
    56400    0.173    0.000    0.854    0.000 protocol.py:238(_parse_field_descriptor)
   185132    0.194    0.000    0.728    0.000 terms.py:363(get_value_sql)
   394940    0.195    0.000    0.667    0.000 protocol.py:165(read_length_coded_string)
     2452    0.012    0.000    0.570    0.000 __init__.py:1138(clear_document_cache)
     4904    0.014    0.000    0.552    0.000 redis_wrapper.py:209(hdel)
     1841    0.007    0.000    0.541    0.000 query.py:99(apply_fields)
   185132    0.248    0.000    0.534    0.000 terms.py:366(get_formatted_value)
     4904    0.006    0.000    0.507    0.000 client.py:3000(hdel)
383366/24536    0.199    0.000    0.472    0.000 copy.py:66(copy)
     1841    0.008    0.000    0.459    0.000 query.py:304(parse_fields)
     6747    0.010    0.000    0.449    0.000 queries.py:925(where)
     4294    0.031    0.000    0.439    0.000 cursors.py:115(mogrify)
     6747    0.030    0.000    0.432    0.000 queries.py:1148(_validate_table)
     1841    0.003    0.000    0.427    0.000 query.py:274(sanitize_fields)
    23922    0.031    0.000    0.424    0.000 dialects.py:99(__copy__)
     1842    0.005    0.000    0.423    0.000 query.py:275(_sanitize_field)
     1842    0.006    0.000    0.417    0.000 __init__.py:45(format)
     1840    0.008    0.000    0.408    0.000 terms.py:187(isin)
     4294    0.008    0.000    0.408    0.000 cursors.py:105(_escape_args)
     7361    0.012    0.000    0.400    0.000 terms.py:56(fields_)
     4294    0.055    0.000    0.398    0.000 cursors.py:109(<dictcomp>)
     2452    0.012    0.000    0.394    0.000 document.py:887(run_method)
     3684    0.010    0.000    0.380    0.000 filter_stack.py:25(run)
    23922    0.126    0.000    0.360    0.000 queries.py:741(__copy__)

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Feb 11, 2024
@s-aga-r s-aga-r added backport version-14-hotfix backport to version 14 backport version-15-hotfix and removed needs-tests This PR needs automated unit-tests. labels Feb 11, 2024
@s-aga-r s-aga-r marked this pull request as ready for review February 12, 2024 09:58
@s-aga-r s-aga-r merged commit 2b1e0d3 into frappe:develop Feb 12, 2024
14 checks passed
s-aga-r added a commit that referenced this pull request Feb 12, 2024
perf: production plan submission

(cherry picked from commit aa1c69d)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
s-aga-r added a commit that referenced this pull request Feb 12, 2024
perf: production plan submission

(cherry picked from commit aa1c69d)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
frappe-pr-bot pushed a commit that referenced this pull request Feb 14, 2024
# [15.14.0](v15.13.0...v15.14.0) (2024-02-14)

### Bug Fixes

*  production plan issue with sales order (backport [#39901](#39901)) ([#39904](#39904)) ([88a7248](88a7248))
* add permissions to SRE (backport [#39780](#39780)) ([#39786](#39786)) ([ba05648](ba05648))
* Brazilian COA for demo data creation ([#39839](#39839)) ([4daee6d](4daee6d))
* calculate `stock_value_diff` ([5a66c85](5a66c85))
* create SBB for `transfer_qty` in SE (backport [#39835](#39835)) ([#39863](#39863)) ([92e6017](92e6017))
* do not consider rejected warehouses in pick list (backport [#39539](#39539)) (backport [#39804](#39804)) ([#39811](#39811)) ([30dacce](30dacce))
* incorrect planned qty in PP (backport [#39785](#39785)) ([#39793](#39793)) ([60e04ab](60e04ab))
* landed cost voucher not submitting because of incorrect reference (backport [#39898](#39898)) ([#39900](#39900)) ([a548f12](a548f12))
* remove duplicates from tax category map ([3c6114a](3c6114a))
* set rate for PO created against BO (backport [#39765](#39765)) ([#39767](#39767)) ([2213886](2213886))
* stock entry for use serial batch fields (backport [#39843](#39843)) ([#39844](#39844)) ([43fce29](43fce29))
* use correct field name in accounts controller (backport [#39884](#39884)) ([#39897](#39897)) ([f08b424](f08b424))
* **ux:** set rate as price list rate on uom change in MR (backport [#39816](#39816)) ([#39818](#39818)) ([63b4d20](63b4d20))
* validate duplicate SBB (backport [#39862](#39862)) ([#39866](#39866)) ([a2f1a96](a2f1a96))
* warehouse issue in pick list (backport [#39826](#39826)) ([#39827](#39827)) ([b625b05](b625b05))

### Features

* get RM costs from consumption entry in manufacture SE (backport [#39822](#39822)) ([#39847](#39847)) ([2d5f186](2d5f186))

### Performance Improvements

* cached get_last_purchase_details to fix performance issue (backport [#39854](#39854)) ([#39856](#39856)) ([c643e70](c643e70))
* production plan submission (backport [#39846](#39846)) ([#39860](#39860)) ([10f17df](10f17df))
frappe-pr-bot pushed a commit that referenced this pull request Feb 14, 2024
## [14.62.4](v14.62.3...v14.62.4) (2024-02-14)

### Bug Fixes

*  production plan issue with sales order (backport [#39901](#39901)) ([#39903](#39903)) ([ab7e323](ab7e323))
* accommodate for default rounding method in v14 ([d6a758d](d6a758d))
* broken route option in Profitability report ([f79e0d1](f79e0d1))
* calculate `stock_value_diff` ([8f58b61](8f58b61))
* cancel asset capitalization ([2438600](2438600))
* do not throw validation for canceled SLE (backport [#39769](#39769)) ([#39810](#39810)) ([2885b8f](2885b8f))
* Handling circular linking while cancelling asset capitalization ([f2d094d](f2d094d))
* incorrect planned qty in PP (backport [#39785](#39785)) ([#39792](#39792)) ([df9d52d](df9d52d))
* landed cost voucher not submitting because of incorrect reference (backport [#39898](#39898)) ([#39899](#39899)) ([d0b9c56](d0b9c56))
* remove duplicates from tax category map ([c56f3a5](c56f3a5))
* set rate for PO created against BO (backport [#39765](#39765)) ([#39766](#39766)) ([de47e67](de47e67))
* set route options to cost center ([#37235](#37235)) ([79a16ba](79a16ba))
* **ux:** set rate as price list rate on uom change in MR (backport [#39816](#39816)) ([#39817](#39817)) ([de6e8c7](de6e8c7))

### Performance Improvements

* cached get_last_purchase_details to fix performance issue (backport [#39854](#39854)) ([#39855](#39855)) ([08e0271](08e0271))
* production plan submission (backport [#39846](#39846)) ([#39859](#39859)) ([a61cffd](a61cffd))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant