Page MenuHomePhabricator

Increase typeahead speed
Open, Needs TriagePublic

Description

Why is the typeahead so slow? I often type a whole user's name and press tab to move on to the next field before the typeahead catches up--only to find my typed-in text has been deleted. Maddening.

Event Timeline

angie raised the priority of this task from to Needs Triage.
angie updated the task description. (Show Details)
angie added a project: Restricted Project.
angie added subscribers: angie, jhurwitz, liza.
chad added a subscriber: chad.

Does is seem faster here? Which typeaheads specifically seem slow?

These execute with a median speed of about 150ms on this install, for the ~1,200 requests made in the last 24 hours (this is across all typeahead source types).

We have 32,917 registered users.

After upgrading to a version of Phabricator with Multimeter, can you:

  • Make sure Multimeter is installed
  • Wait 24 hours of normal use.
  • Show us the Multimeter data for typeahead datasources on your install:
    • Browse to "/multimeter/".
    • Click "Web Request".
    • Click "(All)" under "Label".
    • Click "web.PhabricatorTypeaheadModularDatasourceController" under "Label".
    • Screenshot the page (it should look like the image above).

Oh, you may have to click "(All)" under Request to expand that column to make it look like the screenshot.

On this site, in the user field, I can type my whole username "liza" and hit tab/enter before the typeahead comes up. I run into this a lot in the project field in our installation, too. If the next name is similar to mine, e.g. "lisa" (or on this site "lizarc"), they'll probably appear within 1-2 characters, but if it's totally different, e.g. "angie", then I can still type at least 4-5 characters before the typeahead appears.

I hate slowing down for a UI element to confirm what I've already finished typing. The dropdown is handy when I'm not sure of a person's username, but I know all of my team by username already, so it's often just slowing me down.

Oh, so you're typing as fast as you can and immediately tabbing out of the field (in less than a second)?

We can make the "clear the field after you tab out" code wait until any pending requests resolve. That won't help if you're so fast that you type liza, then type tab, then type your entire comment, then submit the form in less than 150ms, but should improve the responsiveness.

Alternatively, we could require usernames to contain a minimum of 16 characters with at least one uppercase letter, one symbol, and three or more of the same letter in a row.

Oh, so you're typing as fast as you can and immediately tabbing out of the field (in less than a second)?

Yep!

Though sometimes I'm typing as fast as I can adding multiple people, in which case I'd still have to wait for the first user before typing the second user?

then type your entire comment, then submit the form in less than 150ms,

heh, not likely. ;)

a minimum of 16 characters with at least one uppercase letter, one symbol, and three or more of the same letter in a row.

#shipit

Though sometimes I'm typing as fast as I can adding multiple people, in which case I'd still have to wait for the first user before typing the second user?

Yeah. We can also look into actually making it faster -- there's probably some room to improve it, I just wanted to make sure this wasn't some huge discrepancy between the performance we're seeing and the performance you're seeing, since that could indicate some other root cause. I'm not sure we can make it so fast that we always beat you, but we might be able to win the race a little more often.

We could also prefetch/cache the results to make it instantaneous, but this is a bit more involved because we can't prefetch every user (in the general case, as on this install, there are 40K users). But we might be able to do something like preload the last 50 users you've actually typed, so that it would almost always be instantaneous and the times it wasn't you'd probably want to double-check the name anyway since it would be someone whose name you typed less often.

<3

I would love it to remember my last 50 people. (Projects too!)

the times it wasn't you'd probably want to double-check the name anyway since it would be someone whose name you typed less often.

totally!

I've most often noticed this when "associating project" on a Maniphest task. I'd sometimes have to wait several seconds for the typeahead to appear.

We just upgraded today, and after playing around a bit, this (anecdotally) appears to be better for me. Though, it could also be because it's a weekend and our server has less load. I'll try again on Monday.

We now have Multimeter installed, so I can get some data soon.

Here is our multimeter data:

But for another piece of data, I ran this experiment:

  • Go to /maniphest/task/create/
  • Type two characters into the "projects" field, then wait (but leave the projects field focused)
  • Watch the Chrome network console to see how long the AJAX call takes
  • Repeat with a different two characters

When I run this experiment now (at 2am), the calls are returning in 400-700ms. When I ran it during business hours earlier today, they were consistently taking 2.5-3s.

Re-running my experiment (typing two characters at a time), AJAX calls are now taking 700-1000 ms.

I would propose that we make this task into: Prefetch/cache 50 users and 50 projects for the typeahead.

jhurwitz moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jun 16 2015, 9:12 PM

I ideally want to resolve T8588 before pursuing this since it's the more fundamental performance issue, even though this isn't particularly entwined with that.

The behavioral fixes are <1 hour of work; the caching is 1ish.