Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8844 closed enhancement (fixed)

Faster wp_clone function

Reported by: sambauers Owned by: anonymous
Priority: normal Milestone: 2.8
Component: Optimization Version: 2.7
Severity: normal Keywords:
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 4 years ago.
wp_clone-php4-syntax.patch (417 bytes) - added by sambauers 4 years ago.

Download all attachments as: .zip

Change History (8)

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

comment:2   ryan4 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   ryan4 years ago

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

  • Resolution fixed deleted
  • Status changed from closed to reopened

Fix for syntax errors in PHP4 attached.

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

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

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

Note: See TracTickets for help on using tickets.