These numbers are less impressive than those we saw earlier. (Though, staticLevel=1 includes functions like these:Īnd I don't know if they qualify as top-level, global functions.) (I don't have data on the sizes of these scripts, just their counts.) Only 23.3% weren't run and had staticLevel of 1. So, 32.4% of scripts weren't run and had staticLevel of 2. Everything before that indicates the frequencies. The last number is the script's staticLevel. The 2nd last number is 0 or 1 indicating if the script ran. I also looked at the staticLevels of the scripts, because I've been talking with Luke about only lazily compiling global top-level functions, because they're easy to reparse (as opposed to nested functions, where there's more associated compilation state). ![]() So 70.83% weren't run, and they accounted for 59.97% of the script bytes (computed with |sizeof(JSScript) + script->computedSizeOfData()|). After browsing a bit at Gmail, TechCrunch and (with the mjit disabled for both content and chrome), I got this for a 64-bit Linux build: Splinter Review I did some measurement using the attached patch. Measurement patch attached (Note: all jits are turned off to measure). Reducing this by half or more would be awesome. I think this really matters: JS scan/parse/emit can take double digit percent of total browser pageload and about:memory often shows ~1MB 'script' usage per tab. In the inline script case (which may not matter, need to measure this), apparently the chars are stored in the DOM, but they can be mutated so we'd need some COW strategy. In the external script case, Jonas informs me we can pin the buffer in the network cache to keep it alive. We could do much better, though, by cooperating with the caller to reference the char buffer (rather like JSExternalString). I just did a measurement of the size comparison between chars and JSScript::totalSize and found that, on average, JSScript::totalSize is 3-4 times bigger than the chars from which it was compiled. The simplest/default thing would be to just store a snapshot. Chrome seems to faithfully report these, despite using a lazy parsing strategy perhaps we could borrow theirs :)Īnother question is how to recover the chars. Thus, the scanner would need to be smart enough to do this too. In addition to needing to build a scanner to find the end of a function (non-trivial with regexps), there is a class of errors that ES5 Chapter 16 specifies need to be reported early. "Session" is me browsing news/blogs for 10 minutes.Īssuming I haven't made some critical error in my measurement patch (I did test it on toy examples) it seems clear we have some opportunity to optimize here.Ī basic approach would be to give JSFunction an extra state (in addition to isNative()/isInterpreted()): isNotCompiledYet() and then change our various call routines to compile if not compiled yet. Note that measurements were taken on shutdown after everything has been finalized and not filtered by compartment or anything, just a sum total for the whole browser. ![]() ![]() # scripts created / dead / % totalSize created / dead / % I accumulated the absolute and % of dead scripts measured as well as the script->totalSize() for each. Splinter Review I wrote a patch to see if, by the time a script was finalized, it had ever been run. Measure dead scripts and average JSScript::totalSize / chars ratio
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |