Skip to Content
Menu
This question has been flagged
3 Replies
6611 Views

Hi all,

Lately I've been playing a lot with PageSpeed Insights improving the performance of my website (with Online Odoo hosting) for SEO purposes and I've come to the point where the file web.assets_frontend_lazy.min.js is the performance bottleneck.


Even though it is supposed to be minified it is heavily unminified. Around line 9787 all the way to the end line, 12278, there is a QWEB code with heavy indentation, lots of extra whitespaces and comments. Why is there a qweb template loaded into a JS variablie in a file that is supposed to be JS minified only... Anyway, the rest of the file seems properly minified with uselful comments left as title to split the code into chunks. That's good.


So, with this in mind I did a test. Downloaded that file (2.4MB !), applied a conservative minifying algorithm eliminating mostly just comments (no uglyfiyng!) and size went down to 2.25MB, and then a bit more by doing some manual whitespacing removal in my script editor for a total savings of let's round it up to 6.5% of file size. (That's a lot for just extra whitespace and comments). Then reuploaded it into the database replacing the original bundle and ran more PageSpeed tests. 

My mobile homepage was scoring around 75 with the best score at 79 with about 800ms blocking time.  I ran more tests and immediately got multiple results over 80, with the highest at 84 with a blocking time of 530ms. I conclude the results went up by 5 points in performance alone from merely removing comments and whitespace. A massive improvemet.

 

The point I want to make for the Odoo team is that further minifying that file will heavily increase performance for all users. Keep mind that the browser will stop the page rendering while downloading the brotli compressed web.assets_frontend_lazy.min.js (603kb (default) vs 571kb (modified)), uncompress it, parse the JS (bottleneck is here), execute and render the page. 

Further improvements could be made by even removing some legacy functions in that file. Also, archiving some Assets helps to reduce the JS file a bit, however, there are only about 20-30 js assets that can be archived. Way more assets need to be made accesible for end users to archive them.


Thanks!

Avatar
Discard
Best Answer

From where I can get the lazyload assets was not able to find it got an error Uncaught promise error under the lazyload min js file but was not able to find it through developer section.

Avatar
Discard
Author Best Answer

Hi Julien, 

Thanks for replying here and via support ticket.

Interesting, didn't know Odoo was open source. Cool. Maybe in the future I could do a PR. 

I'm using the Odoo online hosted option (enterprise). Where exactly can I find the python files mentioned in those documents? I'm searching the manifest one but can't find it. All I can find are these Assets but they are quite limited.

 

If my understading is correct, the python framework is only available to the either those hosting the open source version or the .sh plan, right? but that framework isn't available for the enterprise option as they are managed by Odoo themselves. So, coming back to the original topic of this post, that means that if I want to further improve the web.assets_frontend_lazy.min.js file, my only option is editing it after it is automatically compiled and then re uploading to the backend?

Avatar
Discard
Best Answer

Hi Juan !

Here is the documentation about assets bundles https://www.odoo.com/documentation/16.0/developer/reference/frontend/assets.html

Basically every module has a manifest file where it defines which file should be in which asset bundle.

The process of retrieving the file paths to be included in those bundles is done here: https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/models/ir_asset.py#L90

The minifying process is done here:

https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/models/assetsbundle.py


If you have ideas about improving those processes you are more than welcome to contribute. Here is how you can do that: https://github.com/odoo/odoo/wiki/Contributing. Feel free to report some issues or even make a PR !
Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
417
1
Dec 21
1576
0
Jun 24
891
0
Jun 23
2425
1
May 24
15136