addons-code-manager icon indicating copy to clipboard operation
addons-code-manager copied to clipboard

General performance issues

Open wagnerand opened this issue 5 years ago • 4 comments

As of now, the code manager at least seems slower than the old file viewer.

A random example using an average extension shows the code manager takes more than twice to load the manifest.json file.

https://reviewers.addons.mozilla.org/en-US/firefox/files/browse/3438240/ took 2.47s for me* https://code.addons.mozilla.org/en-US/browse/548332/versions/4893865/ took 5.33s for me

(that's the same version/file).

*Note that the first load of this might take longer due to the way the old file viewer works: The add-on file is extracted on demand and then cached for about one hour. If you see the file viewer taking much more time than noted here, make sure to load the page once without measuring performance, then fully reload the page right after, this time measuring performance.

┆Issue is synchronized with this Jira Task

wagnerand avatar Dec 03 '19 21:12 wagnerand

I noticed two issues while looking at this but I'm not sure if fixing them would have a big impact or not.

  • https://github.com/mozilla/addons/issues/1816 (browse API should be faster when cached)
  • https://github.com/mozilla/addons-code-manager/issues/1301 (JS bundle is not gzip encoded)

kumar303 avatar Dec 03 '19 22:12 kumar303

A major player here is https://github.com/mozilla/addons/issues/7141 which will be an issue for both, the browse and the compare views.

For compare views specifically there's an issue mentioned in https://github.com/mozilla/addons/issues/1807 with how we're caching / generating improved metadata for deleted files that needs some improving.

EnTeQuAk avatar Dec 04 '19 14:12 EnTeQuAk

Another example:

https://reviewers.addons.mozilla.org/en-US/firefox/files/browse/3462885/file/js/jquery-3.3.1.js#top takes about 6 seconds. https://code.addons.mozilla.org/en-US/browse/2613096/versions/4918511/?allowSlowPages=false&path=js%2Fjquery-3.3.1.js takes about 10 seconds for the shortened file. Worse, in this case I need to see the entire file. https://code.addons.mozilla.org/en-US/browse/2613096/versions/4918511/?allowSlowPages=true&path=js%2Fjquery-3.3.1.js takes about 21s to load.

So, combined it took me more than 5 times as long to see the file in code-manager than in file viewer. Even without the switch of "allowSlowPages", it's still almost twice as much.

wagnerand avatar Dec 06 '19 10:12 wagnerand

Thanks, these examples will be really helpful in making improvements.

https://code.addons.mozilla.org/en-US/browse/2613096/versions/4918511/?allowSlowPages=false&path=js%2Fjquery-3.3.1.js takes about 10 seconds for the shortened file.

The code for this file displays in about 3 seconds for me in either Firefox 70.0.1 or Chrome 78 on macOS 10.14.6. I guess my machine is a bit faster so that, at least, provides you with some hope that upgrading your work laptop could get you a better experience (as a quick fix). My machine is a MacBook Pro (Late 2018), 2.9 GHz Intel Core i9, 32 GB RAM.

But, yeah, it's not great that the CPU demand is so high in this case.

Worse, in this case I need to see the entire file. https://code.addons.mozilla.org/en-US/browse/2613096/versions/4918511/?allowSlowPages=true&path=js%2Fjquery-3.3.1.js takes about 21s to load.

This takes me about 10 seconds.

The API isn't the main bottleneck here but there might be low hanging fruit in speeding up the order of calls. I filed https://github.com/mozilla/addons-code-manager/issues/1320

On the UI side (the main bottleneck), there are ideas here for virtualizing these views to speed them up: https://github.com/mozilla/addons-code-manager/issues/1234

kumar303 avatar Dec 06 '19 16:12 kumar303