Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#8844 closed enhancement (fixed)

Faster wp_clone function

Reported by: sambauers's profile 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 16 years ago.
wp_clone-php4-syntax.patch (417 bytes) - added by sambauers 16 years ago.

Download all attachments as: .zip

Change History (8)

#1 @jacobsantos
16 years ago

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

#2 @ryan
16 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
16 years ago

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

#4 @sambauers
16 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Fix for syntax errors in PHP4 attached.

#5 @azaozz
16 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
16 years ago

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

Note: See TracTickets for help on using tickets.