Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#10125 closed defect (bug) (fixed)

Code optimisations for timezone dropdown builder.

Reported by: sambauers Owned by:
Priority: high Milestone: 2.8.1
Component: Date/Time Version: 2.8
Severity: normal Keywords: timezones, has-patch
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 4 years ago.
faster_timezone_selector_building_NO_nbsp.diff (11.3 KB) - added by demetris 4 years ago.
Removes NBSPs padding for timezone cities. See ticket #10206

Download all attachments as: .zip

Change History (9)

  • Keywords has-patch added

comment:2 follow-up: ↓ 3   ryan4 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   sambauers4 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.

Re-uploaded patch with that fix plus one other.

Removes NBSPs padding for timezone cities. See ticket #10206

comment:5   ryan4 years ago

See #10210

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

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

Note: See TracTickets for help on using tickets.