Thursday, February 2, 2023
1 change · master
Enhancements to existing features
Odoo now calculates internal field update rules only when needed instead of doing all of them upfront. This significantly reduces installation time for large module sets and speeds up the first request on new workers without changing business behavior.
Original PR description
This patch optimizes the way field trigger trees are computed. Overall, the resulting trigger trees are mostly identical, but they can now be determined one by one, which enables an on-demand…
This patch optimizes the way field trigger trees are computed. Overall, the resulting trigger trees are mostly identical, but they can now be determined one by one, which enables an on-demand approach and partial cache. Before this patch, getting the first trigger tree proceeded as follows: - resolve the dependencies of all fields; - compute the transitive closure of the dependencies of all fields; - store the transitive closure above as field triggers for all fields in a cache. After this patch, getting the first trigger tree proceeded as follows: - resolve the dependencies of all fields; - cache them as direct triggers for all fields; - compute one trigger tree as the transitive closure of the field's triggers, and cache it. This optimization is quite effective during the installation of modules, and is even more effective when the number of fields is large. For instance, a complete installation with all community modules is now takes 25% less time. For a complete installation with all enterprise modules, the installation time is even 30% less! A medium installation is about 16% less time. The optimization also speeds up the first request on a new Odoo worker, since the minimum time for computing a handful of trigger trees is much smaller than before. We have observed slight differences in trigger trees, but they occur in places where the tree has redundant branches, in particular with fields having recursive dependencies. It therefore makes no difference in what is being triggered or invalidated.