Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#10125 closed defect (bug) (fixed)

Code optimisations for timezone dropdown builder.

Reported by: sambauers's profile sambauers Owned by:
Milestone: 2.8.1 Priority: high
Severity: normal Version: 2.8
Component: Date/Time Keywords: timezones, has-patch
Focuses: Cc:

Description

The new timezone dropdown builds noticeably slowly in 2.8 causing lag when opening the general options page in admin.

The main problem was with inefficient use of translate functions within the usort callback.

Secondarily, the loop which builds the actual options html was using a string concatenation method which pulls and pushes the same variable in and out of memory hundreds of times.

The following patch fixes both of these problems and generally tidies things up. Performance is improved noticeably.

Attachments (2)

faster_timezone_selector_building.diff (11.3 KB) - added by sambauers 14 years ago.
faster_timezone_selector_building_NO_nbsp.diff (11.3 KB) - added by demetris 14 years ago.
Removes NBSPs padding for timezone cities. See ticket #10206

Download all attachments as: .zip

Change History (9)

#1 @sambauers
14 years ago

  • Keywords has-patch added

#2 follow-up: @ryan
14 years ago

Haven't looked the whole patch over yet, but __() can accept only literal strings. translate() should be used if passing a variable or function return.

#3 in reply to: ↑ 2 @sambauers
14 years ago

Replying to ryan:

Haven't looked the whole patch over yet, but __() can accept only literal strings. translate() should be used if passing a variable or function return.

I'll fix this and resubmit the patch.

#4 @sambauers
14 years ago

Re-uploaded patch with that fix plus one other.

@demetris
14 years ago

Removes NBSPs padding for timezone cities. See ticket #10206

#6 @ryan
14 years ago

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

(In [11597]) Optimize timezone dropdown creation. Props sambauers. fixes #10125 for trunk

#7 @ryan
14 years ago

(In [11598]) Optimize timezone dropdown creation. Props sambauers. fixes #10125 for 2.8.1

Note: See TracTickets for help on using tickets.