Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#60094 closed defect (bug) (reported-upstream)

Performance Issue in Object Cloning using JSON.parse(JSON.stringify()) on Safari and Firefox

Reported by: omeri6's profile omeri6 Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.4
Component: External Libraries Keywords: needs-patch
Focuses: performance Cc:


Elementor uses JSON.parse( JSON.stringify( object ) ) to clone objects.
Our users report significant performance issues on Safari and FireFox browsers
from version 6.4 of WordPress.
Our performance team confirmed that the loading time on Chrome is faster.

We have detected that the problem is associated with the following commit of corejs (used in wp-polyfill):

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:

Change History (4)

#1 @swissspidy
5 months ago

  • Component changed from General to External Libraries
  • Keywords changes-requested removed
  • Severity changed from major to normal

Just so understand correctly, your suggestion is to change which core-js modules are provided by the wp-polyfill script because you ran into some issues with JSON.parse( JSON.stringify( object ) ) in your custom plugin?

I think that would require a ticket on the Gutenberg repo as it seems to come from the babel-preset-default package.

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.

5 months ago

#4 @swissspidy
5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.