[wp-trac] [WordPress Trac] #60095: Performance issue in Object Cloning using JSON.parse(JSON.stringify()) on Safari and Firefox
WordPress Trac
noreply at wordpress.org
Mon Dec 18 14:09:37 UTC 2023
#60095: Performance issue in Object Cloning using JSON.parse(JSON.stringify()) on
Safari and Firefox
--------------------------+-------------------------------------------
Reporter: omeri6 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.4
Severity: major | Keywords: needs-patch changes-requested
Focuses: performance |
--------------------------+-------------------------------------------
WordPress 6.4 started using the latest version of core-js. This latest
version creates significant performance issues in Safari and Firefox for
Elementor users, and for any other plugins or products using JSON parse to
clone objects.
Our performance team confirmed that the loading time on Chrome is faster.
We detected that the problem is associated with the following commit of
core-js (used in wp-polyfill): [https://github.com/zloirock/core-
js/commit/08ceeb13e78aeb366a3fcf481698ec05f77e7b2f]
We managed to partially solve the issue by replacing the code with
structuredClone( object ). However we couldn't replace all the occurrences
of JSON.parse( JSON.stringify( object ) ) with structuredClone(), as
structuredClone() doesn't accept methods.
Using alternative solutions to deep clone objects either increased loading
time or had no effect.
After discussing the issue directly with corejs team, they suggested the
following solution:
[https://github.com/zloirock/core-js/issues/1316]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60095>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list