Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Issue 2438263002: Possibly merge consecutive script fragments to reduce execution overhead

Created:
4 years, 2 months ago by lingyun
Modified:
4 years, 1 month ago
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, kinuko+watch, loading-reviews+parser_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Possibly merge consecutive script fragments to reduce execution overhead When parsing webpages written with multiple consecutive script fragments in below form or similar, '<script> ... </script> <script> ... </script>' HTMLScriptRunner will be called for each script fragment, which brings extra overhead in execution. The CL can effectively merge these consecutive scripts together and run them at once to reduce execution cost when parsing HTML. Telemetry page_cycler tests with Cyan chromebook show ~20% improvement on loading the Gmail page in pageset top_25, using warm_times as the performance indicator. BUG=658131

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+219 lines, -6 lines) Patch
M AUTHORS View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h View 2 chunks +15 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp View 5 chunks +160 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/platform/text/SegmentedString.h View 3 chunks +43 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (9 generated)
lingyun
PTAL
4 years, 2 months ago (2016-10-21 08:52:25 UTC) #2
tkent
+kouhei Does this mean resultant DOM tree is not same before this CL?
4 years, 2 months ago (2016-10-21 08:59:47 UTC) #5
Charlie Harrison
On 2016/10/21 08:59:47, tkent wrote: > +kouhei > > > Does this mean resultant DOM ...
4 years, 2 months ago (2016-10-21 12:24:53 UTC) #6
kinuko
20% improvement sounds pretty attractive, but I think the general direction is rather we might ...
4 years, 2 months ago (2016-10-21 14:34:13 UTC) #11
tkent
On 2016/10/21 at 12:24:53, csharrison wrote: > On 2016/10/21 08:59:47, tkent wrote: > > +kouhei ...
4 years, 2 months ago (2016-10-24 01:17:21 UTC) #12
kouhei (in TOK)
Hmm. I'd be more interested to know where the performance gain come from. I don't ...
4 years, 2 months ago (2016-10-24 01:33:03 UTC) #13
hong.zheng
because Lingyun is on leave, I am on behalf of her to do some update
4 years, 1 month ago (2016-10-25 08:54:22 UTC) #15
hong.zheng
On 2016/10/21 12:24:53, Charlie Harrison wrote: > On 2016/10/21 08:59:47, tkent wrote: > > +kouhei ...
4 years, 1 month ago (2016-10-25 08:54:55 UTC) #16
hong.zheng
On 2016/10/21 14:34:13, kinuko wrote: > 20% improvement sounds pretty attractive, but I think the ...
4 years, 1 month ago (2016-10-25 08:55:43 UTC) #17
hong.zheng
On 2016/10/24 01:17:21, tkent wrote: > On 2016/10/21 at 12:24:53, csharrison wrote: > > On ...
4 years, 1 month ago (2016-10-25 08:56:18 UTC) #18
hong.zheng
On 2016/10/24 01:33:03, kouhei wrote: > Hmm. I'd be more interested to know where the ...
4 years, 1 month ago (2016-10-25 08:56:53 UTC) #19
lingyun
On 2016/10/21 14:34:13, kinuko wrote: > 20% improvement sounds pretty attractive, but I think the ...
4 years, 1 month ago (2016-11-07 05:48:46 UTC) #20
lingyun
On 2016/10/24 01:17:21, tkent wrote: > On 2016/10/21 at 12:24:53, csharrison wrote: > > On ...
4 years, 1 month ago (2016-11-07 05:50:43 UTC) #21
Charlie Harrison
Another thing that would be worthwhile to check is an about:tracing log before and after ...
4 years, 1 month ago (2016-11-08 15:01:50 UTC) #22
lingyun
4 years, 1 month ago (2016-11-11 08:28:25 UTC) #24
On 2016/11/08 15:01:50, Charlie Harrison wrote:
> Another thing that would be worthwhile to check is an about:tracing log before
> and after the patch is applied. I wonder if this is affecting v8 compilation.

I've recorded the trace files by using Telemetry option "--profiler=trace". The
tracing statistics (in ms) of the page-loading period are shown as below:
               w/ patch   w/o patch   improvement
warm_times      2859*       3119*       260
break-down
v8.compile      602         602          -
v8.execute      1867        2104        237

The performance gap 260ms mainly lies in the v8.execute part (237ms
improvement), and I'm planning to have a deeper break-down inside this. Do you
perhaps have any insights about it?

One thing needs to be mentioned is that the tracing introduces 1000+ ms overhead
to the final results of both w/ and w/o patch (i.e.,1783ms with no tracing and
3119ms with tracing for results w/o patch), thus the performance improvement is
not as obvious as the previous ones. I don't know if there is a better way for
profiling with less overhead when running Telemetry.

Besides, Gmail page is complex and I wonder if we could use the extracted Gmail
HTML file, which is also the main HTML parsed during the loading period and
consist of 100+ consecutive scripts, for analyzing. It has similar behavior with
above statistics when loaded locally (i.e., performance gap in v8.execute part):
              w/ patch	w/o patch
parseHTML     620.334	802.416					
v8.compile    582.905	562.822	         
v8.execute    22.875	207.908

Because I can't attach anything here, so for reference, the gmail loading traces
w/ and w/o patch are updated in BUG#658131 Comment#7 in .zip format, and the
extracted Gmail HTML file is in Comment#5 as 'gmail_js.html'.

Powered by Google App Engine
This is Rietveld 408576698