There is room to optimize the record instanciation in the __getattr__
We noticed that accessing a M2O field from a X2M field could result in as many instantiations as there are records in the X2M field.
It could be a performance bottleneck due to the many creations of Model kwargs (and thus calls to transaction.get_cache
) and potential useless calls of transaction.set_context()
.
In the course of investigating the performance bottleneck we also found that calling get
on a O2M result in a lot of instantiations, this should also be circumvented.
Edited by Nicolas Évrard