Page MenuHomePhabricator

Optimize formatValue in UploadWizard
Closed, ResolvedPublic

Description

UploadWizard uses MediaInfo's statements widgets, which render some wikibase properties for which the label needs to be fetched from the API.
On MediaInfo's image page, these API calls are optimized away by fetching then on the server and pre-populating the formatValue cache (see MediaInfoEntityStatementsView::getFormatValueCache & .wbmi-entityview-statementsGroup's data-formatvalue attribute)

We should similarly speed up these API calls in UploadWizard.
I can think of 2 ways:

  • let MediaInfo generate these & expose to JS (since it makes the statements module available to UploadWizard, might as well stuff that in MediaInfo as well...)
  • or, as soon as UploadWizard detects that MediaInfo is installed, it could fire off those formatValue calls already - they'll be resolved & in cache by the time we hit the metadata step...

Event Timeline

Change 499443 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Optimize formatValue for synchronous calls

https://gerrit.wikimedia.org/r/499443

I decided to *not* optimize this in UploadWizard.
Performing them ahead of time is overhead that we may not need (in case we don't make it to that step)

  • they don't block metadata step, there's just a minor render delay of certain texts, but...
  • those API calls should be damn fast in prod anyway

I do have a patch that will make sure the same-time same-value formatValue calls only perform 1 API call

Change 499443 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Optimize formatValue for synchronous calls

https://gerrit.wikimedia.org/r/499443