Issue 9225

Title
ModelStorage __getattr__ small optimizations
Priority
feature
Status
resolved
Superseder
Improve memory usage of storing record values (issue 9369)
Nosy list
albertca, ced, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2020-04-15.00:35:50 by albertca, last changed 5 months ago by roundup-bot.

Messages

New changeset baa1fcd4a061 by Cédric Krier in branch 'default':
Use custom class to store record data
https://hg.tryton.org/tryton-env/rev/baa1fcd4a061
New changeset 22260a3783da by Cédric Krier in branch 'default':
Use custom class to store record data
https://hg.tryton.org/trytond/rev/22260a3783da
New changeset b569af4f7d88 by Cédric Krier in branch 'default':
Use custom class to store record data
https://hg.tryton.org/modules/party_relationship/rev/b569af4f7d88
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-05-26.17:32:44
Here is review297861002 which reuse the idea of review323101002 but generalize to all kind of fields (instead of only to xxx2one, xxx2many and reference).
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-05-10.16:04:51
The proposal change does not help to detect bugs or miss-usage.
It would be allowed if we could guarantee that the local_cache can not be filled with unknown keys. Maybe using a namedtuple could solve that.
Author: [hidden] (albertca) Tryton committer
Date: 2020-04-15.00:35:49
ModelStorage.__getattr__ is called millions of times so trying to do some small optimizations can have some impact in many cases.

I tested using a simple loop:

Location = pool.get('stock.location')
loc = Location(1)
for x in range(300000 * 5):
    loc.provisioning_location
    loc.overflowing_location

The optimizations proposed in the review improve performance by about 16%.
History
Date User Action Args
2020-06-13 09:48:47roundup-botsetmessages: + msg58685
2020-06-13 09:48:38roundup-botsetmessages: + msg58683
2020-06-13 09:48:33roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg58681
2020-05-26 18:38:03reviewbotsetmessages: + msg58298
2020-05-26 18:07:38reviewbotsetmessages: + msg58295
2020-05-26 17:32:45cedsetstatus: in-progress -> testing
reviews: 323101002 -> 323101002,297861002
superseder: + Improve memory usage of storing record values
messages: + msg58291
2020-05-25 19:31:46cedsetstatus: testing -> in-progress
assignedto: ced
2020-05-10 16:04:51cedsetnosy: + ced
messages: + msg57937
2020-04-15 08:55:20pokolisetnosy: + pokoli
2020-04-15 01:39:24reviewbotsetnosy: + reviewbot
messages: + msg57160

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