Tryton - Issues

 

Issue6983

Title Validation of pyson domain
Priority feature Status testing
Superseder Nosy List ced, reviewbot
Type performance Components trytond
Assigned To ced Keywords review
Reviews 39021002
View: 39021002

Created on 2017-12-01.12:41:13 by ced, last changed by reviewbot.

Messages
review39021002 updated at https://codereview.tryton.org/39021002/#ps1
msg37134 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-12-01.17:37:29
Here is review39021002. I have only one arbitrary value which is to divide by 10 the IN_MAX which define how much domains are grouped in the new strategy. So this means that I considered the PYSON domain will not generate 10 times more chars than the id clause.
I have also set a fallback to old strategy, if the list of target records is too big.
msg37130 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-12-01.12:41:12
The validation of pyson domain groups them per evaluated domain but it is not enough to be fast in all cases. Simple domain like the one on Sale.shipment_address [1] generates in most cases unique domain for each record.
So this generates one search for each record validated, so the code is O(n) instead of O(1) (per bunch of 1000).

I think we could improve the heuristic by splitting the test into two cases:

- the number of different domains are low compare to the number of records, so we keep the current validation: [(id, in, ids), domain]

- the number of different domains is almost equals to the number of records tested. We must include in each domain the ids of the records. So it will become: domain = [(id, =, id), domain_for_id] and we group all those domains per  bunch of ids.

[1] [('party', '=', If(Bool(Eval('shipment_party')), Eval('shipment_party'), Eval('party')))]
History
Date User Action Args
2017-12-01 17:58:21reviewbotsetnosy: + reviewbot
messages: + msg37135
2017-12-01 17:37:29cedsetstatus: in-progress -> testing
reviews: 39021002
messages: + msg37134
keyword: + review
2017-12-01 15:23:50cedsetstatus: unread -> in-progress
assignedto: ced
2017-12-01 12:41:13cedcreate

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