Eliminate activation-blocking API request from VisualEditor startup
Open, NormalPublic8 Story Points

Description

Loading VisualEditor involves fetching HTML from RESTBase and page metadata from the action API, which makes it only as fast as the slower of the two requests, which is typically the one to the action API.

We could obviate the need for the action API request by embedding the metadata that VisualEditor currently gets from the API in the view page HTML. The total size of this data appears to be negligible: for Barack Obama, it is 2.3 kB uncompressed; adding it to the view page HTML would increase its total size by about 0.23%. (The data also looks like it could be trivially reduced to a much smaller size by serializing it differently.) That's a very modest price to pay for what would likely be a big win for VisualEditor.

We do need to make sure we don't make the backend response time for uncached page views worse by forcing MediaWiki to do a lot of work it would not otherwise need to do. This seems doable. Most of the data is already needed for rendering the page, so it's simply a matter of making sure VisualEditor's PHP code can see it. Fetching the remaining data can in many cases be deferred until after the editor loads.

Here is a breakdown of the data that is produced by the action API endpoint for VisualEditor:

  • Edit notices
    • Anon edit warning
    • Read-only warning
    • New page notice
    • Title protected warning
    • Protection warnings
    • Permissions errors
    • User pages of missing user
    • User pages of blocked user
    • Blocked notice (if editor is blocked)
    • Global blocks
  • Checkboxes (expensive to compute but probably deferrable)
    • Minor
    • Watch
    • FlaggedRev
  • Red links
  • Protection classes
  • Watched status
  • Base timestamp
  • Start timestamp
  • Old ID
ori created this task.Apr 2 2016, 5:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 2 2016, 5:46 PM
Jdforrester-WMF triaged this task as Normal priority.Apr 2 2016, 5:52 PM
Jdforrester-WMF set the point value for this task to 8.
Krinkle added a subscriber: Krinkle.Apr 4 2016, 7:02 PM