-
- Downloads
[FIX] res.partner: performance of name_get()
Rev. 93e9a4dc tried to speed up the 9.0 name_get() of res.partner by only calling fields_get() once for the whole name_get, instead of calling it lazily. This may have worked for name_get calls on multiple unnamed addresses (name is NULL), but this is a rare occurrence in practice - while now every single name_get() call would incur the full cost of the fields_get() call. That fields_get() call is O(n) in the number of fields, and there can be quite a few for res.partner. Calling it only for the specific 'type' field can easily be about 40x faster than without it. And since name_get() is called for each Many2One field of each record being read (due to convert_to_read()), reading a batch of records with partner fields had become quite a bit slower! Avoiding this cost entirely with lazy fields_get() calls saves quite a lot of time for the common cases. And now that fields_get() specifies a single field, it is cheap enough to be called within the loop. Non-scientific benchmark: account.invoice.search_read() in the list view of invoices took 500ms for 25 invoices _before_ this fix, and 90ms after!
Loading
Please register or sign in to comment