[wp-trac] [WordPress Trac] #33898: Reduce Customizer peak memory usage by JSON-encoding settings and controls separately

WordPress Trac noreply at wordpress.org
Thu Sep 17 19:41:37 UTC 2015


#33898: Reduce Customizer peak memory usage by JSON-encoding settings and controls
separately
------------------------------+--------------------------
 Reporter:  westonruter       |       Owner:  westonruter
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  4.4
Component:  Customize         |     Version:  3.4
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+--------------------------
Changes (by westonruter):

 * owner:   => westonruter
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"34269"]:
 {{{
 #!CommitTicketReference repository="" revision="34269"
 Customize: Reduce peak memory usage by JSON-encoding settings and controls
 individually.

 When there are hundreds of settings and controls (e.g. nav menu items and
 widget instances) the resulting object that is JSON-encoded can become
 very large, and `wp_json_encode()` can consume a lot of memory to
 serialize it. By breaking down the serialization into multiple calls the
 peak memory usage can be kept in line.

 Moves logic out of `wp-admin/customize.php` into the
 `WP_Customize_Manager` class with new methods:

  * `is_ios()`
  * `get_document_title_template()`
  * `get_preview_url()`/`set_preview_url()`
  * `get_return_url()`/`set_return_url()`
  * `get_autofocus()`/`set_autofocus()`
  * `customize_pane_settings()`

 Includes unit tests for these methods, for which the logic was formerly
 untestable in `customize.php`.

 Fixes #33898.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33898#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list