Tryton - Issues



Author ced
Date 2020-05-26.17:23:45
For now, the values of a record are set as dictionaries in the local and transactional caches.
But dictionaries are memory expensive:

>>> sys.getsizeof({})
>>> sys.getsizeof([])
>>> sys.getsizeof(object())

But a class with __slots__ have a size of 16 + 8 per slot (64 without slots but it contains a __dict__ of 248).

So we see that we can store 29 ((248 - 16) / 8) slots for the same memory size as an empty dict.

So the proposal is to create a record class for each model that has a slot for each field and some methods similar to dict like get, keys, items, update etc. Those class should be used in local and transaction caches and in _values and _init_values.
The side effect is that we also receive an automatic check that prevents to fill the cache record with unknown fields (thanks to the slots).
Date User Action Args
2020-05-26 17:23:46cedsetmessageid: <>
2020-05-26 17:23:46cedlinkissue9369 messages
2020-05-26 17:23:45cedcreate

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