Arthur Detroux (ard) ce3f689b2f [FIX] web_editor: improve perfs of background animations on Chrome
Prior to this commit, animations on SVG shapes could use a lot of CPU
and make the page stutter on some website + machine combo.

This does not seem to be an "Odoo Only" issue as browsers seem to
struggle to optimise SVG movements and end up consuming a decent amount
of CPU depending on the machine, the size of the SVG and its position
(behind or on top of other elements).

This commit applies a new class which will warn the browser that the
element is animated. Depending on the browser, some optimisations are
done.
On Chrome and Safari, a new layer is created which simplifies the
rendering of the page and sometimes takes advantage of hardware
acceleration.
On Firefox, no optimisation is done yet. This might change in an update
which would take advantage of the CSS Property.

The documentation says to only use `will-change` when an element is
about to change. This is the case however, as most of the shape's
animations are looping. Which is why it's applied to every shape that is
animated.

This optimisation only applies to background shapes with this commit.

Performance improvements observed by (at)rdeodoo on his machine:
- SVG: 200% CPU
- SVG + fix (will-change): 55% CPU
(additional infos available in the PR)

To note: one way to easily see the improvement is on the "Layers" tab of
the Chrome devtools. Before this commit, the entire #wrapwrap is
repainted every time the shape changes (so 60 times per second since
that is the framerate the browser aims for). With this commit, the
#wrapwrap and the shape are contained in their own layers so the
#wrapwrap is only painted once.

Other solutions were considered but not used at this time:
- Reducing the frame rate of the animations. This is not currently
possible because browsers do not offer any way of doing that.
- Removing bits of the shape can reduce its CPU consumption, but
whenever a transform animation is present, the CPU usage remains high.

task-3142001

closes odoo/odoo#114252

X-original-commit: 03418be1c67e71a22f6d2ce79675280f889b663c
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-03-02 21:56:48 +01:00
2023-03-02 18:18:50 +01:00
…
…
…
…
2023-01-03 13:16:02 +01:00
2023-01-03 13:16:02 +01:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%