WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10125 closed defect (bug) (fixed)

Code optimisations for timezone dropdown builder.

Reported by: 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 5 years ago.
faster_timezone_selector_building_NO_nbsp.diff (11.3 KB) - added by demetris 5 years ago.
Removes NBSPs padding for timezone cities. See ticket #10206

Download all attachments as: .zip

Change History (9)

comment:1 sambauers5 years ago

  • Keywords has-patch added

comment:2 follow-up: ryan5 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.

comment:3 in reply to: ↑ 2 sambauers5 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.

comment:4 sambauers5 years ago

Re-uploaded patch with that fix plus one other.

demetris5 years ago

Removes NBSPs padding for timezone cities. See ticket #10206

comment:6 ryan5 years ago

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

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

comment:7 ryan5 years ago

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

Note: See TracTickets for help on using tickets.