[IMP] base: performances of view._check_xml
View validation accounts for a fair cost of module installation, most of that is spent checking for view validity, and a significant fraction of *that* is spent reading the validated view from the DB. Turns out _check_xml requested *all* view fields even though it needed none of them save for the arch. Specifying fields to read_combined rather than fetching all fields seems to result in a ~30% speedup of _check_xml (under line_profiler). Most of the rest is spent fetching sub-views (in get_inheriting_view_arch), I don't know that it can be improved without hand-crafting a fairly complex SQL request.
This commit is contained in:
parent
443c38dbc0
commit
d1a19bcb7f
|
@ -203,7 +203,7 @@ class view(osv.osv):
|
|||
# Sanity checks: the view should not break anything upon rendering!
|
||||
# Any exception raised below will cause a transaction rollback.
|
||||
for view in self.browse(cr, uid, ids, context):
|
||||
view_def = self.read_combined(cr, uid, view.id, None, context=context)
|
||||
view_def = self.read_combined(cr, uid, view.id, ['arch'], context=context)
|
||||
view_arch_utf8 = view_def['arch']
|
||||
if view.type != 'qweb':
|
||||
view_doc = etree.fromstring(view_arch_utf8)
|
||||
|
@ -527,7 +527,7 @@ class view(osv.osv):
|
|||
|
||||
# arch and model fields are always returned
|
||||
if fields:
|
||||
fields = list(set(fields) | set(['arch', 'model']))
|
||||
fields = list({'arch', 'model'}.union(fields))
|
||||
|
||||
# read the view arch
|
||||
[view] = self.read(cr, uid, [root_id], fields=fields, context=context)
|
||||
|
|
Loading…
Reference in New Issue