Skip to content
Snippets Groups Projects
Commit 47b44e1a authored by Xavier-Do's avatar Xavier-Do
Browse files

[FIX] base: speedup generate_assets_nodes


is_transpiled is only needed when generating a asset bundle while
JavascriptAsset can be generated to compute the version hash.

is_transpiled needs to read the content to be defined which is quite
slow. Transforming is_transpiled into a lazy property will speedup the
cold loading of generate_assets_node, especially when attachment already
exists.

Locally:
- /web with all modules in debug=assets goes from ~350 to ~150 ms
- generate_assets_nodes part goes from ~230 to ~55 ms

closes odoo/odoo#116035

Signed-off-by: default avatarSimon Genin (ges@odoo) <ges@odoo.com>
parent 674f37fb
Branches
Tags
No related merge requests found
......@@ -987,9 +987,15 @@ class JavascriptAsset(WebAsset):
def __init__(self, bundle, inline=None, url=None, filename=None):
super().__init__(bundle, inline, url, filename)
self.is_transpiled = is_odoo_module(super().content)
self._is_transpiled = None
self._converted_content = None
@property
def is_transpiled(self):
if self._is_transpiled is None:
self._is_transpiled = bool(is_odoo_module(super().content))
return self._is_transpiled
@property
def content(self):
content = super().content
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment