Page MenuHomePhabricator

Parallel exact match lookup might make template search more responsive
Open, Needs TriagePublic

Description

As part of T274903: Change template search in VisualEditor to use standard search API we made sure an exact match is always shown at the very top of the dropdown when searching for a template name. This is critical for templates like Template:!!. As of https://gerrit.wikimedia.org/r/693157 the code does an additional API request to achieve this. The main disadvantage of this approach is a lower response time which can be noticeable while typing a template name.

Suggestion:

  • Run the two API requests in parallel (using promises) and continue when both are finished.
  • Note: The exact match request may be useless in case the other request already contains the exact match. This should be fine. It might waste a bit of bandwidth, but usually doesn't waste time – at least not when we assume that the exact match request is always faster. It might also be possible to quit the exact match earlier when it turns out it's not needed.

Open question:

  • Maybe it's possible to achieve the same (or even better) performance gain by combining the other 2 API requests (search + templatedata) that already exist? Compare with MediaWiki-extensions-TemplateWizard where this is already done.