In https://gerrit.wikimedia.org/r/c/mediawiki/core/+/932819 we plan to make a change to how we handle client side preferences. The significant changes are switching from storing these in cookies to storing them in localStorage and storing multiple values in a JSON string that must be parsed,
Previously, in T327798#8554853, we profiled localStorage to get a rough idea and found that it was 1.7ms longer but still under the 50ms cut-off to be considered a long task however we didn't profile the use of JSON.parse. We'd like to get more confidence going into the change.
To do this, we will compare the current version of the inline script VS the new script.
Two static HTML files are provided in https://gist.github.com/jdlrobson/407cde7f0b894c23244fda83581bee3e that simulate https://en.wikipedia.org/wiki/Brazil, with the following modifications:
- The tag <base href="https://en.wikipedia.org"> was added to BrazilVersion1.html
- BrazilVersion2.html is an identical copy of BrazilVersion1.html with the exception of an inline script created by the following method:
- checked out https://gerrit.wikimedia.org/r/c/mediawiki/core/+/932819
- applied the diff file in https://gist.github.com/jdlrobson/407cde7f0b894c23244fda83581bee3e
TODO
Hypothesis to prove/disprove: Parsing JSON stored in localStorage at this point does not introduce any long tasks and has more or less identical performance.
Method
- Prep the test for version 1 vs version 2 - make sure the following code is run in the environment that will run the test and disable the:
mw.cookie.set('mwclientprefs', 'vector-feature-limited-width'); localStorage.setItem('mw-client-preferences', JSON.stringify( { 'vector-feature-limited-width' : 1 } ) );
- Locally compare HTML version 1 VS HTML version 2
- Analyse the differences in performance that you are seeing and document in the ticket
Stretch goal:
- If possible repeat with real devices as a synthetic test in https://gerrit.wikimedia.org/r/q/project:performance%252Fsynthetic-monitoring-tests+status:open
sign off steps
- Evaluate the analysis work.