Thanks,
Ehsan
_______________________________________________
firefox-dev mailing list
firef...@mozilla.org
https://mail.mozilla.org/listinfo/firefox-dev
- Are there some profile links showing what the startup/shutdown of the browser looks like with this extension installed?
and a plan for adding the automated testing we need to avoid it?
Hi Ehsan,Thanks for your questions! We've put some answers together below (although Ian may have more to add here when he returns Wednesday).
> Are there some profile links showing what the impact of the extension to the browser's idle time looks like? Does the extension need to run code in the background, either lazily or periodically for certain tasks?
No code runs in the background.
> Are there some profile links showing the performance of the extension as the screenshot feature itself is being used?
This performance hasn't been graphed. We should minimize any slowdown here, but also recognize that it would be from the direct action of a user and so could be expected. Thanks for the perf-html information. We've created an issue to create one of these profiles (https://github.com/mozilla-services/screenshots/issues/2554), would you have any resources to help us get going here? And/or is there more documentation aside from your response in this thread?
We've also created an issue to record how long it takes to process an image (https://github.com/mozilla-services/screenshots/issues/2555).
> Does the extension need to do I/O? How does it achieve that? If it uses sqlite, has there been an analysis on the sqlite query performance? If it uses other types of storage, has there been analysis on the performance of other such mechanisms?
We don't use sqlite, we do use `browser.storage.local` for a small amount of account data.
> Does the extension need to do expensive image manipulation on the main thread?
No.
> Are there any other details which would be interesting to know from a performance perspective?
This is a relatively simple extension that is not in the primary UI flow. It doesn't do anything until the user specifically engages with it.
--On Mon, Apr 3, 2017 at 9:47 AM, Ehsan Akhgari <ehsan....@gmail.com> wrote:On Mon, Apr 3, 2017 at 12:19 PM, Dave Townsend <dtow...@mozilla.com> wrote:On Mon, Apr 3, 2017 at 9:16 AM, Ehsan Akhgari <ehsan....@gmail.com> wrote:On Mon, Apr 3, 2017 at 12:11 PM, Mark Banner <mba...@mozilla.com> wrote:On 03/04/2017 16:45, Ehsan Akhgari wrote:
I'll let Ian answer most of this. What I can say that has definitely been done are Talos runs which showed no regressions.
- Are there some profile links showing what the startup/shutdown of the browser looks like with this extension installed?
https://github.com/mozilla-services/screenshots/issues/2317Talos should be thought of more as a smoke detector for this kind of feature. That it has not shown any regressions should be a sign that the building isn't on fire, not necessarily that the feature is ready to be shipped. :-)Unfortunately at this time we have no automated tools that can analyze the impact of a few front-end feature without a lot of manual performance investigation.Do we have good documentation on how to do the manual performance investigationThe basics are pretty simple: go to https://perf-html.io, install the profiler add-on and start profiling using the instructions on that page! We don't unfortunately have a lot of great documentation at this point due to the lack of bandwidth to produce it. Sorry about that. We're trying our best to move fast on all fronts here but we're really starved for choosing what to work on. :-(Last Friday at the Quantum Flow work week here in Toronto, I gave an informal talk about how to use the Gecko Profiler since people were interested in seeing how I use it. I didn't have any slides or any specific profiling scenario prepared so I decided to profile Firefox live and delve into a couple of scenarios in the parent and content processes. The presentation is being uploaded right now and will be available at this link once finished: <https://air.mozilla.org/gecko-profiler-introduction/>. I hope this will be a good starting point. If people have questions about how to use the profiler and how to read the profiles, I and others hanging out in #flow would be happy to help answer questions!and a plan for adding the automated testing we need to avoid it?Automated testing for this is easier said than done... :/ In general building a tool that can analyze an arbitrary feature without knowing anything about it in advance is a research problem. The reason tools like Talos aren't a suitable measurement utility here is that they have no tests that would directly measure anything that this feature would directly impact, and most of their tests are probably too noisy for any potential impact that the feature _could_ be introducing to show up in any significant way in the test output numbers. This excludes tests like Ts, in theory, but in practice even those tests have been less helpful in preventing startup regressions than I would really like... Why that is the case, I'm not really sure. It could be due to issues in Talos, or in how we use it, or both. Again, using Ts as an example, we have gotten more than twice as bad over the past year on this Ts Windows 32-bit e10s PGO measurement <https://treeherder.mozilla.org/perf.html#/graphs?timerange=31536000&series=%5Bmozilla-central,e394aab72917d169024558cbab33eb4e7e9504e1,1,1%5D>, so perhaps there is just a death by a thousand cuts effect at play here.But for the time being, I think we shouldn't bet the farm on just running tests on Talos, especially for features that don't even get the regular Talos testing that normal features developed on m-c get.
--EhsanCory Price/ckprice
On Mon, Apr 3, 2017 at 1:20 PM, Cory Price <cpr...@mozilla.com> wrote:Hi Ehsan,Thanks for your questions! We've put some answers together below (although Ian may have more to add here when he returns Wednesday).
> Are there some profile links showing what the impact of the extension to the browser's idle time looks like? Does the extension need to run code in the background, either lazily or periodically for certain tasks?
No code runs in the background.Great!Does the add-on inject a frame script into every page? Or only into the pages that the user wants to take a screenshot from?
> Are there some profile links showing the performance of the extension as the screenshot feature itself is being used?
This performance hasn't been graphed. We should minimize any slowdown here, but also recognize that it would be from the direct action of a user and so could be expected. Thanks for the perf-html information. We've created an issue to create one of these profiles (https://github.com/mozilla-services/screenshots/issues/2554), would you have any resources to help us get going here? And/or is there more documentation aside from your response in this thread?What kind of resources did you have in mind? I personally have very limited time these days and a ton of things to investigate, but I looked a bit at the code and found a few things that are probably worth paying more attention to, which I commented on in the issue above.
Someone needs to poke into this using a profiler to discover more. :-)
On Mon, Apr 03, 2017 at 11:45:22AM -0400, Ehsan Akhgari wrote:
Has there been any performance testing on Firefox with the screenshots extension installed?
There's a known startup performance regression when any WebExtension is installed, since we don't load most of the WebExtension modules until they're needed. This is less of an issue now that bugs 1350522 and 1344590 are fixed, and will be less still once bug 1317697 is fixed and extensions are loaded out of process by default.
It's probably worth noting that this isn't a per-extension regression. We pay the price for the first extension that we load. The subsequent ones we basically get for free. So once OOP extensions are enabled by default, we actually run less risk of startup perf or UI jank regressions for features implemented as extensions than we would otherwise.
WebExtension add-ons do not yet run in their own dedicated process, so I expect that the majority of the code for this add-on will run in the parent process, where performance issues can cause UI jank.
The majority of the code should run in a content script, which would usually run in the content process if e10s is enabled. The code that runs in the parent process is mostly pretty trivial.
- Does the extension need to do I/O? How does it achieve that? If it
uses sqlite, has there been an analysis on the sqlite query performance?
If it uses other types of storage, has there been analysis on the
performance of other such mechanisms?
Note: I'm currently pushing for the extension to switch its storage backend to IndexedDB, for the sake of transactions, which is backed by SQLite. But its storage usage is minimal, and primarily just for credential storage.
On Mon, Apr 3, 2017 at 12:32 PM, Ehsan Akhgari <ehsan....@gmail.com> wrote:On Mon, Apr 3, 2017 at 1:20 PM, Cory Price <cpr...@mozilla.com> wrote:Hi Ehsan,Thanks for your questions! We've put some answers together below (although Ian may have more to add here when he returns Wednesday).
> Are there some profile links showing what the impact of the extension to the browser's idle time looks like? Does the extension need to run code in the background, either lazily or periodically for certain tasks?
No code runs in the background.Great!Does the add-on inject a frame script into every page? Or only into the pages that the user wants to take a screenshot from?Not on every page, so the latter. Ref: https://github.com/mozilla-services/screenshots/issues/2554#issuecomment-291263613
> Are there some profile links showing the performance of the extension as the screenshot feature itself is being used?
This performance hasn't been graphed. We should minimize any slowdown here, but also recognize that it would be from the direct action of a user and so could be expected. Thanks for the perf-html information. We've created an issue to create one of these profiles (https://github.com/mozilla-services/screenshots/issues/2554), would you have any resources to help us get going here? And/or is there more documentation aside from your response in this thread?What kind of resources did you have in mind? I personally have very limited time these days and a ton of things to investigate, but I looked a bit at the code and found a few things that are probably worth paying more attention to, which I commented on in the issue above.Someone needs to poke into this using a profiler to discover more. :-)
Thanks for commenting! A resource to "poke at this using a profiler to discover more" as noted below would be great to have. Our backlog is full, so identifying anything severe should happen soon (this week?), and someone familiar with the tools and severity of items would be extremely helpful.
If there's documentation on the "performance review" process and ownership I'd love to subscribe so I'm not behind on the next thing.
On Tue, Apr 4, 2017 at 4:56 PM, Kris Maglione <kmag...@mozilla.com> wrote:On Mon, Apr 03, 2017 at 11:45:22AM -0400, Ehsan Akhgari wrote:
Has there been any performance testing on Firefox with the screenshots extension installed?
There's a known startup performance regression when any WebExtension is installed, since we don't load most of the WebExtension modules until they're needed. This is less of an issue now that bugs 1350522 and 1344590 are fixed, and will be less still once bug 1317697 is fixed and extensions are loaded out of process by default.
It's probably worth noting that this isn't a per-extension regression. We pay the price for the first extension that we load. The subsequent ones we basically get for free. So once OOP extensions are enabled by default, we actually run less risk of startup perf or UI jank regressions for features implemented as extensions than we would otherwise.This does mean that the first extension that gets shipped to all users by default like this will cause this regression to happen, right?
On Wed, Apr 05, 2017 at 10:05:15AM -0700, Dave Townsend wrote:
On Tue, Apr 4, 2017 at 2:44 PM, Ehsan Akhgari <ehsan....@gmail.com>
wrote:
This does mean that the first extension that gets shipped to all users by
default like this will cause this regression to happen, right?
Have we measured this regression? Do we have a bug on file for it?
Yes. See bug 1317681. I believe it's somewhere around 45ms at this point.
On Wed, Apr 05, 2017 at 10:05:15AM -0700, Dave Townsend wrote:
On Tue, Apr 4, 2017 at 2:44 PM, Ehsan Akhgari <ehsan....@gmail.com>
wrote:
This does mean that the first extension that gets shipped to all users by
default like this will cause this regression to happen, right?
Have we measured this regression? Do we have a bug on file for it?
Yes. See bug 1317681. I believe it's somewhere around 45ms at this point.
There should be no significant performance hit until after startup() is
called. Hm. Or, at least, there wouldn't if LegacyExtensionUtils didn't
eagerly import a couple of other WebExtension modules. We should be able to
fix that in an upliftable way, though. XPIProvider really doesn't need to load
that module until the startup() method is called.
>The other possible regression that Screenshots could introduce is that it
>adds a content script to all screenshots.firefox.com pages. The content
>script itself isn't a concern IMHO (it's just part of the performance of
>screenshot pages) but as a result it does activate the the WebExtension
>matching code that decides whether to add the content script to a given
>page.
You're right that that introduces a small amount of additional overhead, but
at this point it's pretty reasonable. I'm planning to rewrite most of that
matching code in C++ soon, at which point the overhead probably won't be
measurable.
We have an explicit call to webExtension.startup() in our bootstrap.js – would the performance hit be when the startup method is called, or before then (e.g., when the webExtension object is created)? Just curious if we could accomplish anything by deferring the startup.
There should be no significant performance hit until after startup() is called. Hm. Or, at least, there wouldn't if LegacyExtensionUtils didn't eagerly import a couple of other WebExtension modules. We should be able to fix that in an upliftable way, though. XPIProvider really doesn't need to load that module until the startup() method is called.
We have an explicit call to webExtension.startup() in our bootstrap.js – would the performance hit be when the startup method is called, or before then (e.g., when the webExtension object is created)? Just curious if we could accomplish anything by deferring the startup.
There should be no significant performance hit until after startup() is called. Hm. Or, at least, there wouldn't if LegacyExtensionUtils didn't eagerly import a couple of other WebExtension modules. We should be able to fix that in an upliftable way, though. XPIProvider really doesn't need to load that module until the startup() method is called.Ah, but note that our bootstrap.js directly Cu.import()s LegacyExtensionUtils. Would it help to lazily import that module instead? LegacyExtensionUtils isn't called inside bootstrap until after startup(), so, maybe? https://github.com/mozilla-services/screenshots/blob/master/addon/bootstrap.js#L61
On 5 Apr 2017, at 21:17, Jared Hirsch <6a...@mozilla.com> wrote:
We have an explicit call to webExtension.startup() in our bootstrap.js – would the performance hit be when the startup method is called, or before then (e.g., when the webExtension object is created)? Just curious if we could accomplish anything by deferring the startup.
There should be no significant performance hit until after startup() is called. Hm. Or, at least, there wouldn't if LegacyExtensionUtils didn't eagerly import a couple of other WebExtension modules. We should be able to fix that in an upliftable way, though. XPIProvider really doesn't need to load that module until the startup() method is called.Ah, but note that our bootstrap.js directly Cu.import()s LegacyExtensionUtils. Would it help to lazily import that module instead? LegacyExtensionUtils isn't called inside bootstrap until after startup(), so, maybe? https://github.com/mozilla-services/screenshots/blob/master/addon/bootstrap.js#L61