HomePhorge

Improve time localization code

Description

Improve time localization code

Summary:

  • We throw on a missing date right now, in the DateTime constructor. This can

happen in reasonable cases and this is display code, so handle it more
gracefully (see T520).

  • This stuff is a little slow and we sometimes render many hundreds of dates

per page. I've been seeing it in profiles on and off. Memoize timezones to
improve performance.

  • Some minor code duplication that would have become less-minor with the

constructor change, consolidate the logic.

  • Add some unit tests and a little documentation.

Test Plan:

  • Ran unit tests.
  • Profiled 1,000 calls to phabricator_datetime(), cost dropped from ~49ms to

~19ms with addition of memoization. This is still slower than I'd like but I
don't think there's an easy way to squeeze it down further.

Reviewers: ajtrichards, jungejason, nh, tuomaspelkonen, aran

Reviewed By: ajtrichards

CC: aran, ajtrichards, epriestley

Differential Revision: 966

Details

Provenance
epriestleyAuthored on Sep 27 2011, 9:03 AM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rP016b060aeafd: Add a relation table for Revisions to local commit hashes
Branches
Unknown
Tags
Unknown

Event Timeline