WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 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 8 years ago.
wp_clone-php4-syntax.patch (417 bytes) - added by sambauers 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @jacobsantos
8 years ago

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

#2 @ryan
8 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

#3 @ryan
8 years ago

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

#4 @sambauers
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Fix for syntax errors in PHP4 attached.

#5 @azaozz
8 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

#6 @azaozz
8 years ago

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

Note: See TracTickets for help on using tickets.