@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Don't spend ridiculous amounts of time rebuilding orderable columns

Summary:
Ref T8575. Because orderable columns need to build custom fields, they are relatively expensive to build. Use the request cache.

(The request cache is technically more correct than `static`, because configuration may change between requests and we may eventually reuse interpreters.)

Test Plan: Saw home page time drop 39% (from 462ms to 283ms).

Reviewers: btrahan, avivey

Reviewed By: avivey

Subscribers: avivey, epriestley

Maniphest Tasks: T8575

Differential Revision: https://secure.phabricator.com/D13322

+11
+11
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 872 872 * @task order 873 873 */ 874 874 public function getOrderableColumns() { 875 + $cache = PhabricatorCaches::getRequestCache(); 876 + $class = get_class($this); 877 + $cache_key = 'query.orderablecolumns.'.$class; 878 + 879 + $columns = $cache->getKey($cache_key); 880 + if ($columns !== null) { 881 + return $columns; 882 + } 883 + 875 884 $columns = array( 876 885 'id' => array( 877 886 'table' => $this->getPrimaryTableAlias(), ··· 908 917 ); 909 918 } 910 919 } 920 + 921 + $cache->setKey($cache_key, $columns); 911 922 912 923 return $columns; 913 924 }