WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8844 closed enhancement (fixed)

Faster wp_clone function

Reported by: sambauers Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Optimization Keywords:
Focuses: Cc:

Description

The current wp_clone() function calls version_compare() on every execution, which is slooow.

Attached patch stores the result of version_compare() as a static variable. The speedup for bbPress was about 5% on a large site, not profiled in WordPress yet, but result should be similar as wp_clone() is called in cache retrieval processes.

Attachments (2)

wp_clone-optimisation.patch (617 bytes) - added by sambauers 5 years ago.
wp_clone-php4-syntax.patch (417 bytes) - added by sambauers 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 jacobsantos5 years ago

Um, isn't $can_static already set? I usually just use is_null().

comment:2 ryan5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10350]) Run version_compare only once for wp_clone(). Props sambauers. fixes #8844 for trunk

comment:3 ryan5 years ago

(In [10351]) Run version_compare only once for wp_clone(). Props sambauers. fixes #8844 for 2.7

comment:4 sambauers5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Fix for syntax errors in PHP4 attached.

comment:5 azaozz5 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [10353]) Faster wp_clone function fix, props sambauers, fixes #8844 for trunk

comment:6 azaozz5 years ago

(In [10354]) Faster wp_clone function fix, props sambauers, fixes #8844 for 2.7

Note: See TracTickets for help on using tickets.