Issue 11164

Title
Improve speed of get_eval_fields
Priority
feature
Status
resolved
Nosy list
ced, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2022-01-22.01:03:10 by ced, last changed 4 months ago by roundup-bot.

Messages

New changeset dcdc4f7742df by Cédric Krier in branch 'default':
Use simplified parser for get_eval_fields
https://hg.tryton.org/tryton-env/rev/dcdc4f7742df
New changeset a0f8aac350a2 by Cédric Krier in branch 'default':
Use simplified parser for get_eval_fields
https://hg.tryton.org/proteus/rev/a0f8aac350a2
New changeset 84e8871fdf5a by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/tryton-env/rev/84e8871fdf5a
New changeset 0a5b26e5c6fb by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/sale_promotion/rev/0a5b26e5c6fb
New changeset af8df670d6db by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/sale_product_customer/rev/af8df670d6db
New changeset 486124decada by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/sale/rev/486124decada
New changeset 2f4e966463f3 by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/purchase/rev/2f4e966463f3
New changeset 56f63f263227 by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/project_revenue/rev/56f63f263227
New changeset bef8449bb48a by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/production_outsourcing/rev/bef8449bb48a
New changeset a3b5b01d866f by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/product_attribute/rev/a3b5b01d866f
New changeset d2acf3a9425e by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/commission/rev/d2acf3a9425e
New changeset 1a4ae89fb050 by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/carrier_weight/rev/1a4ae89fb050
New changeset c070f798aaab by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/analytic_sale/rev/c070f798aaab
New changeset 2d589125c658 by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/analytic_purchase/rev/2d589125c658
New changeset 4046e2f15711 by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/account_invoice/rev/4046e2f15711
New changeset baecd5987f00 by Cédric Krier in branch 'default':
Add new depends from new get_eval_fields implementation
https://hg.tryton.org/modules/account/rev/baecd5987f00
New changeset 0fe45b90d130 by Cédric Krier in branch 'default':
Use simplified parser for get_eval_fields
https://hg.tryton.org/tryton-env/rev/0fe45b90d130
New changeset 1fe05701cda8 by Cédric Krier in branch 'default':
Use simplified parser for get_eval_fields
https://hg.tryton.org/trytond/rev/1fe05701cda8
New changeset 8d573f681193 by Cédric Krier in branch 'default':
Use simplified parser for get_eval_fields
https://hg.tryton.org/tryton/rev/8d573f681193
New changeset fb62f70ec995 by Cédric Krier in branch 'default':
Use simplified parser for get_eval_fields
https://hg.tryton.org/sao/rev/fb62f70ec995
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-22.01:06:54

Here is review376551002

Testing with:
python -m timeit -s "from trytond.model.fields import get_eval_fields; from trytond.pyson import If, Eval; value = [If(Eval('inherit', ''), ('type', '=', None), ('type', '!=', None))]" 'get_eval_fields(value)'

before:
10000 loops, best of 5: 22.3 usec per loop

after
50000 loops, best of 5: 8.83 usec per loop

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-22.01:03:07

Following discussion on review380081002, using the PYSONEncoder is the optimal because the json encoder is generating many useless string.
Instead we could rely on the fact that as it is json compatible structure, we could just care about PYSON and list, tuple and dict when parsing.
Also we shoud use a method from Eval to get the field name for better concern separation.

History
Date User Action Args
2022-02-22 18:05:10roundup-botsetmessages: + msg74296
2022-02-22 18:05:06roundup-botsetmessages: + msg74295
2022-01-30 20:19:41roundup-botsetmessages: + msg73664
2022-01-30 20:19:38roundup-botsetmessages: + msg73663
2022-01-30 20:19:34roundup-botsetmessages: + msg73662
2022-01-30 20:19:26roundup-botsetmessages: + msg73661
2022-01-30 20:19:18roundup-botsetmessages: + msg73660
2022-01-30 20:19:06roundup-botsetmessages: + msg73659
2022-01-30 20:18:56roundup-botsetmessages: + msg73658
2022-01-30 20:18:46roundup-botsetmessages: + msg73657

Showing 10 items. Show all history (warning: this could be VERY long)