Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Перейти к файлу
Kris Maglione a4368ffba1 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

--HG--
extra : rebase_source : 2ec24c8b0000f9187a9bf4a096ee8d93403d7ab2
extra : absorb_source : bb9d799d664a03941447a294ac43c54f334ef6f5
2017-05-05 16:15:04 -07:00
.cargo Bug 1277338 - Part 1: Turn js/src into the mozjs-sys crate; r=sfink 2016-10-13 16:12:42 -07:00
.vscode Bug 1341585 - Ignore Visual Studio Code workspace settings and add a recommended extensions file. r=gps,jya 2017-02-22 12:57:57 +01:00
accessible Merge m-c to inbound, a=merge 2017-05-02 17:39:58 -07:00
addon-sdk Merge mozilla-central to autoland 2017-05-05 15:27:55 +02:00
browser Merge m-c to inbound, a=merge 2017-05-05 17:19:20 -07:00
build Bug 1360291 - Detect NDK version number; r=nalexander 2017-05-04 19:19:31 -04:00
caps Bug 1344170: set firstPartyDomai on blob: URI. r=smaug 2017-04-24 14:12:03 +08:00
chrome Bug 1360596 - Test against overriden locale packages for available locales changed. r=jfkthame 2017-05-04 10:38:53 -07:00
config Bug 1362516 - disable custom Cargo linker for TSan builds; r=rillian,f=bwc 2017-05-05 16:53:37 -04:00
db Bug 1352260 - Upgrade to SQLite 3.18.0. r=mak 2017-04-01 15:08:18 -04:00
devtools merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
docshell merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
dom Backed out 2 changesets (bug 1360992, bug 1361654) for a 70% failure rate in test_fileReader.html on ASan e10s a=merge 2017-05-05 12:35:57 -07:00
editor Bug 1351548 - Remove reftest-stylo.lists. r=bholley 2017-04-28 11:15:58 +08:00
embedding Bug 1356569 - Remove notifyObservers' last parameter when it is falsy, r=jaws. 2017-04-14 21:51:39 +02:00
extensions Bug 1357107 - Part 2: Remove nsContentBlocker; r=bzbarsky 2017-04-28 00:13:23 -04:00
gfx Backed out changeset eee394a4575b (bug 1361392) for leaksanitizer failures in pretty much all ASAN mochitests a=backout 2017-05-05 15:58:49 -07:00
gradle/wrapper Bug 1300094 - Update Gradle to 2.14.1 and Gradle Plugin to 2.1.3 r=sebastian 2016-09-22 14:31:01 -07:00
hal Bug 1357323 - Remove the gonk code that was referenced by the build system. r=gps 2017-04-18 17:46:39 +09:00
image Bug 1360784 - Revert a workaround for bug 1361632. r=xidorn 2017-05-04 23:35:59 +09:00
intl Bug 1358275 - Preliminary cleanup: refactor nsTextFragment::UpdateBidiFlag(), moving its logic into nsBidiUtils function HasRTLChars() and making that function more precise in the process. r=dholbert 2017-04-26 23:25:48 +01:00
ipc merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
js Bug 1359653: Part 5 - Pre-load scripts needed during startup in a background thread. r=shu,erahm 2017-05-05 16:15:04 -07:00
layout Merge inbound to m-c a=merge 2017-05-05 14:03:31 -07:00
media Backed out changeset 2c7d3f3cb9e8 (bug 1336271) on request for possible memory issues 2017-05-05 09:04:09 +02:00
memory Bug 1334286 - use MOZ_FORMAT_PRINTF in DMD; r=njn 2017-04-21 15:54:05 -06:00
mfbt Bug 1359653: Part 3 - Add a clear() method and move asssignment operator to AutoCleanLinkedList. r=waldo 2017-05-02 17:54:18 -07:00
mobile Backed out changeset b50714bd8d10 (bug 1322650) for failing chrome's test_video_discovery.html and mda's test_Eviction_mp4.html, both on Android. r=backout 2017-05-05 18:55:11 +02:00
modules merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
mozglue Bug 1355559: Suppress stack walking in LdrResolveDelayLoadedAPI. r=mstange,aklotz 2017-05-03 23:26:47 -04:00
netwerk merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
nsprpub Bug 1358466 - Define pt_sendto only on Linux and fix comments. r=mcmanus 2017-04-24 17:32:23 +02:00
other-licenses Bug 1345530 - add BUG_COMPONENT to other-licenses/* files. r=tbsaunde, mhowell, overholt 2017-04-05 08:31:10 -04:00
parser Bug 1361632 - Adjust reftest expectation for -moz-appearance. r=bholley. a=merge 2017-05-04 06:39:30 +09:00
probes Bug 1344878 - add BUG_COMPONENT to probes/* files. r=Ms2ger 2017-03-24 09:50:48 -04:00
python Bug 1360291 - Produce android version codes for AArch64/ARM64 Fennec; r=nalexander 2017-05-04 19:19:31 -04:00
rdf Bug 1353143 - Part 5: Replace direct usage of PR_LogPrint. r=froydnj 2017-04-04 14:36:21 -07:00
security Merge inbound to m-c a=merge 2017-05-05 14:03:31 -07:00
services merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
servo servo: Merge #16735 - Rename PushScrollRoot and remove PopScrollRoot (from mrobinson:push-pop-scroll-root); r=glennw 2017-05-05 02:21:12 -05:00
startupcache Bug 1334318 - remove last uses of PR_smprintf; r=froydnj 2017-04-28 10:13:26 -06:00
storage Bug 1334278 - change mozilla::Smprintf to return a UniquePtr; r=froydnj 2017-03-03 08:17:27 -07:00
taskcluster Bug 1350413 part 2: Fix generic-worker configuration. r=dustin a=fix-for-buildbot-bridge-on-osx 2017-05-02 16:12:52 -03:00
testing merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
third_party/rust Bug 1341102: Revendor rust-dependencies manually on a CLOSED TREE. r=emilio 2017-05-01 02:49:23 +02:00
toolkit Bug 1362224: Cache tab incognito state. r=aswan 2017-05-05 13:01:03 -07:00
tools merge mozilla-inbound to mozilla-central a=merge 2017-05-05 15:17:26 +02:00
uriloader Bug 1355585 - Streamline the format of "handlers.json", align the implementation, and reorganize tests. r=mak 2017-04-24 11:29:46 +01:00
view Bug 1321754 Part 2 - Update reftest and crashtest expectations for stylo. r=heycam 2017-04-28 14:53:16 +08:00
widget Backed out changeset d6516a10c808 (bug 1322650) 2017-05-05 18:53:40 +02:00
xpcom Bug 1359653: Part 5 - Pre-load scripts needed during startup in a background thread. r=shu,erahm 2017-05-05 16:15:04 -07:00
xpfe Bug 1352305 - Part 1: Making the XULWindow will not be enforecd to be rounded dimensions if it is a window without a primary content when fingerprinting resistance is enabled. r=Ehsan 2017-05-02 18:11:50 +08:00
.clang-format Bug 1322321 - Update the clang format file to match more our coding style r=ehsan 2016-12-06 17:43:17 -10:00
.clang-format-ignore Bug 1341423 - Integrate OpenVR binding library r=daoshengmu 2017-02-27 16:59:30 -08:00
.clang-tidy Bug 1319396 - Update the list of checkers in the .clang-tidy file r=Ehsan 2016-11-22 12:30:19 +01:00
.cron.yml Bug 1357112 - Add win64 nightly to Taskgraph. r=dustin 2017-05-01 13:43:46 -04:00
.eslintignore Bug 1360237 - Fix eslint issues for devtools/client/framework/devtools-browser.js. r=pbro 2017-04-27 17:21:07 +02:00
.eslintrc.js Bug 1358050: Add no-implied-eval rule to eslint config r=standard8 2017-04-20 10:33:22 +02:00
.flake8 Bug 1321956 - Disable flake8 check for 'visually indented line with same indent as next logical line', r=ahal 2016-12-08 09:53:21 -10:00
.gdbinit Bug 1317802 - don't stop for SIGSYS in .gdbinit; r=jld 2016-11-16 01:13:22 -05:00
.gdbinit_python
.gitignore Bug 1359427 - Hide top-level gecko.log from VCSes; r=gps 2017-04-25 15:30:38 +01:00
.hgignore Bug 1359427 - Hide top-level gecko.log from VCSes; r=gps 2017-04-25 15:30:38 +01:00
.hgtags No bug - Tagging mozilla-central 6583496f169cd8a13c531ed16e98e8bf313eda8e with FIREFOX_AURORA_54_BASE a=release DONTBUILD CLOSED TREE 2017-03-06 23:43:32 +01:00
.inferconfig Bug 1357629 - Add httpclientandroidlib to .inferconfig ignore list r=nalexander,njpark 2017-04-18 20:05:25 -07:00
.lldbinit
.taskcluster.yml Bug 591688 - Notify when decision task fails r=dustin,gps 2017-04-12 21:01:46 -07:00
.ycm_extra_conf.py Bug 1293534: Fix .ycm_extra_conf after bug 1195748. r=gps 2016-08-09 10:30:58 -07:00
AUTHORS Bug 1349980 - update task generation to support -g in try syntax for running OS X tasks in generic-worker,r=dustin 2017-04-06 18:50:41 +02:00
Android.mk
CLOBBER Bug 1357107 - Part 2: Remove nsContentBlocker; r=bzbarsky 2017-04-28 00:13:23 -04:00
GNUmakefile
LEGAL
LICENSE
Makefile.in bug 1355961 - add some sccache stats to build_metrics. r=gps 2017-04-12 15:06:22 -04:00
README.txt Bug 1349108 - Update links in README.txt to HTTPS r=RyanVM 2017-03-21 00:11:02 -04:00
aclocal.m4 Bug 1262155 - Use moz.build instead of libffi's build system. r=ted,glandium 2016-08-08 16:58:54 -07:00
build.gradle Bug 1318823 - Use com.getkeepsafe.dexcount in Gradle builds. r=sebastian 2016-11-18 18:28:58 -08:00
client.mk Bug 1317778 - Emit a depfile with python configure dependencies so Make will know when to re-run configure. r=glandium 2016-12-02 10:05:57 -08:00
client.py
configure.in Bug 1295751 - Make it possible to copy configure.in to configure. r=gps 2016-08-16 19:35:00 -07:00
configure.py Bug 1316140 - Allow use of multiprocessing from config.status on windows. r=mshal 2016-12-21 16:28:28 -08:00
gradle.properties
gradlew
mach Bug 1316140 - Allow use of multiprocessing from config.status on windows. r=mshal 2016-12-21 16:28:28 -08:00
moz.build Bug 1262241 - Move the definition of the js library to a subdirectory. r=mshal 2017-04-04 11:43:14 +09:00
moz.configure Bug 1353810 - add a --enable-rust-debug option; r=chmanchester 2017-04-12 21:49:25 -04:00
mozilla-config.h.in
npm-shrinkwrap.json Bug 1355776 - Upgrade ESLint to version 3.19.0 to pick up autofix improvements and other fixes. r=mossop 2017-04-12 12:07:01 +01:00
old-configure.in Bug 1359552 ANGLE requires MOZ_HAS_WINSDK_WITH_D3D to be set for required includes in MINGW r=gps 2017-04-27 13:43:47 -05:00
package.json Bug 1355776 - Upgrade ESLint to version 3.19.0 to pick up autofix improvements and other fixes. r=mossop 2017-04-12 12:07:01 +01:00
settings.gradle Bug 1291363 - Add geckoview and geckoview_example Gradle projects. r=jchen,sebastian 2016-10-05 20:23:38 -07:00
test.mozbuild

README.txt

An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:

    https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure

For information on how to build Mozilla from the source code, see:

    https://developer.mozilla.org/en/docs/Build_Documentation

To have your bug fix / feature added to Mozilla, you should create a patch and
submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:

    https://developer.mozilla.org/en/docs/Creating_a_patch
    https://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree

If you have a question about developing Mozilla, and can't find the solution
on https://developer.mozilla.org, you can try asking your question in a
mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]

You can download nightly development builds from the Mozilla FTP server.
Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy. Firefox nightlies, for example, can be found at:

    https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
            - or -
    https://nightly.mozilla.org/