Commit Graph

18 Commits

Author SHA1 Message Date
Sebastian Hengst
b9af39bbfa Backed out changeset 2a48f8b743d1 (bug 1361900) 2017-05-13 18:53:15 +02:00
Sebastian Hengst
47a0097791 Backed out changeset 75b28187fa5e (bug 1361900) 2017-05-13 18:53:10 +02:00
Sebastian Hengst
1411620009 Backed out changeset 0b38ac21c7a5 (bug 1361900) 2017-05-13 18:52:25 +02:00
Sebastian Hengst
0545c7ee8d Backed out changeset 23dc7b443bb0 (bug 1361900) 2017-05-13 18:51:57 +02:00
Kris Maglione
5ed1d1edcb Bug 1361900: Fix one last merge botch, and fix a false rooting hazard warning.
MozReview-Commit-ID: JpKYYEBpbQj
2017-05-12 18:14:12 -07:00
Kris Maglione
15e363d2b3 Bug 1361900: Follow-up: Fix order of execution issue. r=me
MozReview-Commit-ID: DcmTlzxskUj
2017-05-12 15:46:34 -07:00
Kris Maglione
c9956d2c0a Bug 1361900: Part 10 - Replace linked lists with a single hashtable. r=erahm
MozReview-Commit-ID: 3qXnswsP6Z0
2017-05-03 16:57:31 -07:00
Kris Maglione
df8e7cf669 Bug 1361900: Part 9 - Sort scripts by initial load time before saving. r=erahm
MozReview-Commit-ID: 54UN2DVK4xM
2017-05-01 14:12:01 -07:00
Kris Maglione
50a722a8d7 Bug 1361900: Part 6 - Add content process support for the script preloader. r=erahm,gabor
MozReview-Commit-ID: 6hDQAI52bKC
2017-05-02 17:17:52 -07:00
Kris Maglione
12df64d482 Bug 1361900: Part 4 - Use a separate script cache for scripts loaded in the child process. r=erahm,gabor
MozReview-Commit-ID: EIdwmuTOl90
2017-05-09 19:52:17 -07:00
Kris Maglione
94d84195be Bug 1361900: Part 2 - Add process types field to cached script data. r=erahm
MozReview-Commit-ID: Gvh672XD0ar
2017-05-03 17:21:31 -07:00
Kris Maglione
5395bd04d5 Bug 1359653: Follow-up: Don't cache mochikit scripts as a temporary bustage workaround.
MozReview-Commit-ID: I4FcZWRKlWr
2017-05-06 14:41:22 -07:00
Kris Maglione
dd0b06b87f Bug 1359653: Part 9 - Observe "startupcache-invalidate" and flush the cache when received. r=erahm
Flushing the cache at startup is already handled automatically by the
AppStartup code, which removes the entire startupCache directory when
necessary. The add-on manager requires being able to flush the cache at
runtime, though, for the sake of updating bootstrapped add-ons.

MozReview-Commit-ID: LIdiNHrXYXu
2017-05-03 12:31:51 -07:00
Kris Maglione
cc1348b222 Bug 1359653: Part 5 - Pre-load scripts needed during startup in a background thread. r=shu,erahm
One of the things that I've noticed in profiling startup overhead is that,
even with the startup cache, we spend about 130ms just loading and decoding
scripts from the startup cache on my machine.

I think we should be able to do better than that by doing some of that work in
the background for scripts that we know we'll need during startup. With this
change, we seem to consistently save about 3-5% on non-e10s startup overhead
on talos. But there's a lot of room for tuning, and I think we get some
considerable improvement with a few ongoing tweeks.

Some notes about the approach:

- Setting up the off-thread compile is fairly expensive, since we need to
create a global object, and a lot of its built-in prototype objects for each
compile. So in order for there to be a performance improvement for OMT
compiles, the script has to be pretty large. Right now, the tipping point
seems to be about 20K.

  There's currently no easy way to improve the per-compile setup overhead, but
we should be able to combine the off-thread compiles for multiple smaller
scripts into a single operation without any additional per-script overhead.

- The time we spend setting up scripts for OMT compile is almost entirely
CPU-bound. That means that we have a chunk of about 20-50ms where we can
safely schedule thread-safe IO work during early startup, so if we schedule
some of our current synchronous IO operations on background threads during the
script cache setup, we basically get them for free, and can probably increase
the number of scripts we compile in the background.

- I went with an uncompressed mmap of the raw XDR data for a storage format.
That currently occupies about 5MB of disk space. Gzipped, it's ~1.2MB, so
compressing it might save some startup disk IO, but keeping it uncompressed
simplifies a lot of the OMT and even main thread decoding process, but, more
importantly:

- We currently don't use the startup cache in content processes, for a variety
of reasons. However, with this approach, I think we can safely store the
cached script data from a content process before we load any untrusted code
into it, and then share mmapped startup cache data between all content
processes. That should speed up content process startup *a lot*, and very
likely save memory, too. And:

- If we're especially concerned about saving per-process memory, and we keep
the cache data mapped for the lifetime of the JS runtime, I think that with
some effort we can probably share the static string data from scripts between
content processes, without any copying. Right now, it looks like for the main
process, there's about 1.5MB of string-ish data in the XDR dumps. It's
probably less for content processes, but if we could save .5MB per process
this way, it might make it easier to increase the number of content processes
we allow.

MozReview-Commit-ID: CVJahyNktKB
2017-05-06 12:24:22 -07:00
Sebastian Hengst
393e7b6bbc Backed out changeset 1c7df9455059 (bug 1359653) 2017-05-06 11:02:23 +02:00
Sebastian Hengst
53028b71e4 Backed out changeset 8f4637881ddc (bug 1359653) 2017-05-06 11:02:04 +02:00
Kris Maglione
881111c21d Bug 1359653: Part 9 - Observe "startupcache-invalidate" and flush the cache when received. r=erahm
Flushing the cache at startup is already handled automatically by the
AppStartup code, which removes the entire startupCache directory when
necessary. The add-on manager requires being able to flush the cache at
runtime, though, for the sake of updating bootstrapped add-ons.

MozReview-Commit-ID: LIdiNHrXYXu
2017-05-03 12:31:51 -07:00
Kris Maglione
ab738f1b0b Bug 1359653: Part 5 - Pre-load scripts needed during startup in a background thread. r=shu,erahm
One of the things that I've noticed in profiling startup overhead is that,
even with the startup cache, we spend about 130ms just loading and decoding
scripts from the startup cache on my machine.

I think we should be able to do better than that by doing some of that work in
the background for scripts that we know we'll need during startup. With this
change, we seem to consistently save about 3-5% on non-e10s startup overhead
on talos. But there's a lot of room for tuning, and I think we get some
considerable improvement with a few ongoing tweeks.

Some notes about the approach:

- Setting up the off-thread compile is fairly expensive, since we need to
create a global object, and a lot of its built-in prototype objects for each
compile. So in order for there to be a performance improvement for OMT
compiles, the script has to be pretty large. Right now, the tipping point
seems to be about 20K.

  There's currently no easy way to improve the per-compile setup overhead, but
we should be able to combine the off-thread compiles for multiple smaller
scripts into a single operation without any additional per-script overhead.

- The time we spend setting up scripts for OMT compile is almost entirely
CPU-bound. That means that we have a chunk of about 20-50ms where we can
safely schedule thread-safe IO work during early startup, so if we schedule
some of our current synchronous IO operations on background threads during the
script cache setup, we basically get them for free, and can probably increase
the number of scripts we compile in the background.

- I went with an uncompressed mmap of the raw XDR data for a storage format.
That currently occupies about 5MB of disk space. Gzipped, it's ~1.2MB, so
compressing it might save some startup disk IO, but keeping it uncompressed
simplifies a lot of the OMT and even main thread decoding process, but, more
importantly:

- We currently don't use the startup cache in content processes, for a variety
of reasons. However, with this approach, I think we can safely store the
cached script data from a content process before we load any untrusted code
into it, and then share mmapped startup cache data between all content
processes. That should speed up content process startup *a lot*, and very
likely save memory, too. And:

- If we're especially concerned about saving per-process memory, and we keep
the cache data mapped for the lifetime of the JS runtime, I think that with
some effort we can probably share the static string data from scripts between
content processes, without any copying. Right now, it looks like for the main
process, there's about 1.5MB of string-ish data in the XDR dumps. It's
probably less for content processes, but if we could save .5MB per process
this way, it might make it easier to increase the number of content processes
we allow.

MozReview-Commit-ID: CVJahyNktKB
2017-05-05 16:15:04 -07:00