Skip to content

Commit a0262c0

Browse files
author
epriestley
committedFeb 14, 2014
Remove tokenizer.ondemand, and always load on demand
Summary: Ref T4420. Tokenizers currently operate in "preload" or "ondemand" modes. In the former mode, which is default, they'll try to load the entire result list when a page loads. The theory here was that this would slightly improve the experience for small installs, and once they got big enough they could switch to "ondemand". In practice, several issues have arisen: - We generally don't have a good mechanism for telling installs that they should tweak perf config -- `metamta.send-immediately` is the canonical example here. Some large installs are probably affected negatively by not knowing to change this setting, and having settings like this is generally annoying. - We have way way too much config now. - With the advent of ApplicationSearch, pages like Maniphest make many redundant loads to prefill sources like projects. Most of the time, this data is not used. It's far simpler to switch everything to ondemand than try to deal with this, and dealing with this would mean creating two very complex divergent pathways in the codebase for a mostly theoretical performance benefit which only impacts tiny installs. - We've been using `tokenizer.ondemand` forever on `secure.phabricator.com` since we have many thousands of user accounts, and it doesn't seem sluggish and works properly. Removing this config is an easy fix which makes the codebase simpler. I've retained the ability to use preloaded sources, since they may make sense in some cases (in at least one case -- task priorities -- adding a static source pathway might make sense), and they're part of Javelin itself. However, the code will no longer ever go down that pathway. Test Plan: Used `secure.phabricator.com` for years with this setting enabled. Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Maniphest Tasks: T4420 Differential Revision: https://secure.phabricator.com/D8232
1 parent 87012d6 commit a0262c0

File tree

9 files changed

+27
-66
lines changed

9 files changed

+27
-66
lines changed
 

‎conf/default.conf.php

-15
Original file line numberDiff line numberDiff line change
@@ -638,21 +638,6 @@
638638
'https' => true,
639639
),
640640

641-
// Tokenizers are UI controls which let the user select other users, email
642-
// addresses, project names, etc., by typing the first few letters and having
643-
// the control autocomplete from a list. They can load their data in two ways:
644-
// either in a big chunk up front, or as the user types. By default, the data
645-
// is loaded in a big chunk. This is simpler and performs better for small
646-
// datasets. However, if you have a very large number of users or projects,
647-
// (in the ballpark of more than a thousand), loading all that data may become
648-
// slow enough that it's worthwhile to query on demand instead. This makes
649-
// the typeahead slightly less responsive but overall performance will be much
650-
// better if you have a ton of stuff. You can figure out which setting is
651-
// best for your install by changing this setting and then playing with a
652-
// user tokenizer (like the user selectors in Maniphest or Differential) and
653-
// seeing which setting loads faster and feels better.
654-
'tokenizer.ondemand' => false,
655-
656641
// By default, Phabricator includes some silly nonsense in the UI, such as
657642
// a submit button called "Clowncopterize" in Differential and a call to
658643
// "Leap Into Action". If you'd prefer more traditional UI strings like

‎resources/celerity/map.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'names' =>
99
array(
1010
'core.pkg.css' => '044c2f0c',
11-
'core.pkg.js' => 'ba6e232d',
11+
'core.pkg.js' => '0dc59a05',
1212
'darkconsole.pkg.js' => 'ca8671ce',
1313
'differential.pkg.css' => '6aef439e',
1414
'differential.pkg.js' => '322ea941',
@@ -431,7 +431,7 @@
431431
'rsrc/js/core/KeyboardShortcutManager.js' => 'ad7a69ca',
432432
'rsrc/js/core/MultirowRowManager.js' => 'e7076916',
433433
'rsrc/js/core/Notification.js' => '95944043',
434-
'rsrc/js/core/Prefab.js' => '1e644329',
434+
'rsrc/js/core/Prefab.js' => '979f864d',
435435
'rsrc/js/core/ShapedRequest.js' => 'dfa181a4',
436436
'rsrc/js/core/TextAreaUtils.js' => 'b3ec3cfc',
437437
'rsrc/js/core/ToolTip.js' => '0a81ea29',
@@ -701,7 +701,7 @@
701701
'phabricator-object-list-view-css' => '1a1ea560',
702702
'phabricator-object-selector-css' => '029a133d',
703703
'phabricator-phtize' => 'd254d646',
704-
'phabricator-prefab' => '1e644329',
704+
'phabricator-prefab' => '979f864d',
705705
'phabricator-profile-css' => '3a7e04ca',
706706
'phabricator-project-tag-css' => '095c9404',
707707
'phabricator-remarkup-css' => 'ca7f2265',
@@ -928,19 +928,6 @@
928928
5 => 'phabricator-drag-and-drop-file-upload',
929929
6 => 'phabricator-draggable-list',
930930
),
931-
'1e644329' =>
932-
array(
933-
0 => 'javelin-install',
934-
1 => 'javelin-util',
935-
2 => 'javelin-dom',
936-
3 => 'javelin-typeahead',
937-
4 => 'javelin-tokenizer',
938-
5 => 'javelin-typeahead-preloaded-source',
939-
6 => 'javelin-typeahead-ondemand-source',
940-
7 => 'javelin-dom',
941-
8 => 'javelin-stratcom',
942-
9 => 'javelin-util',
943-
),
944931
'1f595fb0' =>
945932
array(
946933
0 => 'javelin-install',
@@ -1411,6 +1398,19 @@
14111398
2 => 'javelin-view-visitor',
14121399
3 => 'javelin-util',
14131400
),
1401+
'979f864d' =>
1402+
array(
1403+
0 => 'javelin-install',
1404+
1 => 'javelin-util',
1405+
2 => 'javelin-dom',
1406+
3 => 'javelin-typeahead',
1407+
4 => 'javelin-tokenizer',
1408+
5 => 'javelin-typeahead-preloaded-source',
1409+
6 => 'javelin-typeahead-ondemand-source',
1410+
7 => 'javelin-dom',
1411+
8 => 'javelin-stratcom',
1412+
9 => 'javelin-util',
1413+
),
14141414
'9b9197be' =>
14151415
array(
14161416
0 => 'javelin-behavior',

‎src/applications/config/check/PhabricatorSetupCheckExtraConfig.php

+2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ public static function getAncientConfig() {
178178
'Mail is now always delivered by the daemons.'),
179179
'auth.sessions.conduit' => $session_reason,
180180
'auth.sessions.web' => $session_reason,
181+
'tokenizer.ondemand' => pht(
182+
'Phabricator now manages typeahead strategies automatically.'),
181183
);
182184

183185
return $ancient_config;

‎src/applications/config/option/PhabricatorCoreConfigOptions.php

-26
Original file line numberDiff line numberDiff line change
@@ -137,32 +137,6 @@ public function getOptions() {
137137
" %s", $path))
138138
->addExample('/usr/local/bin', pht('Add One Path'))
139139
->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')),
140-
$this->newOption('tokenizer.ondemand', 'bool', false)
141-
->setBoolOptions(
142-
array(
143-
pht("Query on demand"),
144-
pht("Query on page load"),
145-
))
146-
->setSummary(
147-
pht("Query for tokenizer fields on demand."))
148-
->setDescription(
149-
pht(
150-
"Tokenizers are UI controls which let the user select other ".
151-
"users, email addresses, project names, etc., by typing the ".
152-
"first few letters and having the control autocomplete from a ".
153-
"list. They can load their data in two ways: either in a big ".
154-
"chunk up front, or as the user types. By default, the data is ".
155-
"loaded in a big chunk. This is simpler and performs better for ".
156-
"small datasets. However, if you have a very large number of ".
157-
"users or projects, (in the ballpark of more than a thousand), ".
158-
"loading all that data may become slow enough that it's ".
159-
"worthwhile to query on demand instead. This makes the typeahead ".
160-
"slightly less responsive but overall performance will be much ".
161-
"better if you have a ton of stuff. You can figure out which ".
162-
"setting is best for your install by changing this setting and ".
163-
"then playing with a user tokenizer (like the user selectors in ".
164-
"Maniphest or Differential) and seeing which setting loads ".
165-
"faster and feels better.")),
166140
$this->newOption('config.lock', 'set', array())
167141
->setLocked(true)
168142
->setDescription(pht('Additional configuration options to lock.')),

‎src/applications/differential/view/DifferentialAddCommentView.php

-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ public function render() {
121121
'src' => '/typeahead/common/usersorprojects/',
122122
'value' => $this->reviewers,
123123
'row' => 'add-reviewers',
124-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
125124
'labels' => $add_reviewers_labels,
126125
'placeholder' => pht('Type a user or project name...'),
127126
),
@@ -130,7 +129,6 @@ public function render() {
130129
'src' => '/typeahead/common/mailable/',
131130
'value' => $this->ccs,
132131
'row' => 'add-ccs',
133-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
134132
'placeholder' => pht('Type a user or mailing list...'),
135133
),
136134
),

‎src/applications/diffusion/controller/DiffusionCommitController.php

-2
Original file line numberDiff line numberDiff line change
@@ -780,14 +780,12 @@ private function renderAddCommentPanel(
780780
'actions' => array('add_auditors' => 1),
781781
'src' => '/typeahead/common/users/',
782782
'row' => 'add-auditors',
783-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
784783
'placeholder' => pht('Type a user name...'),
785784
),
786785
'add-ccs-tokenizer' => array(
787786
'actions' => array('add_ccs' => 1),
788787
'src' => '/typeahead/common/mailable/',
789788
'row' => 'add-ccs',
790-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
791789
'placeholder' => pht('Type a user or mailing list...'),
792790
),
793791
),

‎src/applications/maniphest/controller/ManiphestTaskDetailController.php

-3
Original file line numberDiff line numberDiff line change
@@ -308,21 +308,18 @@ public function processRequest() {
308308
ManiphestTransaction::TYPE_PROJECTS => array(
309309
'id' => 'projects-tokenizer',
310310
'src' => '/typeahead/common/projects/',
311-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
312311
'placeholder' => pht('Type a project name...'),
313312
),
314313
ManiphestTransaction::TYPE_OWNER => array(
315314
'id' => 'assign-tokenizer',
316315
'src' => '/typeahead/common/users/',
317316
'value' => $default_claim,
318317
'limit' => 1,
319-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
320318
'placeholder' => pht('Type a user name...'),
321319
),
322320
ManiphestTransaction::TYPE_CCS => array(
323321
'id' => 'cc-tokenizer',
324322
'src' => '/typeahead/common/mailable/',
325-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
326323
'placeholder' => pht('Type a user or mailing list...'),
327324
),
328325
);

‎src/view/form/control/AphrontFormTokenizerControl.php

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ protected function renderInput() {
6464
'value' => mpull($values, 'getFullName', 'getPHID'),
6565
'icons' => mpull($values, 'getTypeIcon', 'getPHID'),
6666
'limit' => $this->limit,
67-
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
6867
'username' => $username,
6968
'placeholder' => $this->placeholder,
7069
));

‎webroot/rsrc/js/core/Prefab.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ JX.install('Prefab', {
5858
}
5959

6060
var datasource;
61-
if (config.ondemand) {
61+
62+
// Default to an ondemand source if no alternate configuration is
63+
// provided.
64+
var ondemand = true;
65+
if ('ondemand' in config) {
66+
ondemand = config.ondemand;
67+
}
68+
69+
if (ondemand) {
6270
datasource = new JX.TypeaheadOnDemandSource(config.src);
6371
} else {
6472
datasource = new JX.TypeaheadPreloadedSource(config.src);

0 commit comments

Comments
 (0)
Failed to load comments.