Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#31260 closed defect (bug) (fixed)

Replace array_shift() with current() in bundled themes

Reported by: SergeyBiryukov Owned by: lancewillett
Priority: normal Milestone: 4.2
Component: Bundled Theme Version:
Severity: normal Keywords: has-patch
Cc: Focuses: performance

Description

Background: #31182

array_shift() recalculates array indexes, and can be slow on large arrays. Most of the time, this is unnecessary, as we only use it to get the first element of the array, and the array is never used later.

Attachments (1)

31260.patch (2.9 KB ) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (5)

#2 @lancewillett
12 years ago

Nice improvement. current() is new to me, glad to know about it.

#3 @lancewillett
12 years ago

  • Owner set to lancewillett
  • Resolutionfixed
  • Status newclosed

In 31453:

Bundled themes: replace array_shift() with current() for performance.

Props SergeyBiryukov, fixes #31260.

#4 @SergeyBiryukov
11 years ago

In 31842:

Bundled themes: After [31453], replace current() with reset(), which is guaranteed to be the first item.

see #31259, #31260.

Note: See TracTickets for help on using tickets.