DescriptionMobile Gmail should use 220 kB less memory
The HTML parser breaks up large text nodes into small chunks to avoid some
O(n^2) editing algorithms. This CL skips that workaround for <script> and
<style> elements, which aren't likely to need editing. As a result, <script>
ends up with a single text node, containing a contiguous String, which is the
source code of that inline script block.
When we go to execute an inline script, we collect up all the text node
children of the <script> element into a single monolithic string. That string
then ends up in V8, where it can be retained (e.g., in the compilation cache).
Prior this CL, we could end up with two copies of large inline scripts: one
monolithic string retained by V8 and a number of shards retained by the DOM.
After this CL, both the DOM and V8 use the same monolithic string, removing a
copy.
Mobile Gmail has a 220 kB inline script, which now is shared between V8 and the
DOM, saving memory.
Separately, we should investigate whether we can remove the length limit
entirely. It's possible that the O(n^2) editing algorithms have been removed
for other reasons.
R=eseidel
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=151717
Patch Set 1 #
Messages
Total messages: 4 (0 generated)
|