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

Issue 68893014: Allocate stack item for fragment context elements once (Closed)

Created:
7 years, 1 month ago by davve
Modified:
7 years, 1 month ago
Reviewers:
eseidel
CC:
blink-reviews, dglazkov+blink, adamk+blink_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Allocate stack item for fragment context elements once Instead of allocating stack items for fragment context elements on demand, do it once when creating the fragment context and re-use the stack item during parsing. This avoids excessive calls to malloc when parsing for innerHTML. BUG=318711 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=162047

Patch Set 1 #

Patch Set 2 : Allocate stack item in fragment constructor #

Total comments: 2

Patch Set 3 : Get rid of PassRefPtr #

Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -15 lines) Patch
M Source/core/html/parser/HTMLTreeBuilder.h View 1 2 2 chunks +4 lines, -3 lines 0 comments Download
M Source/core/html/parser/HTMLTreeBuilder.cpp View 1 2 7 chunks +11 lines, -12 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
davve
Eric, was it something like this you had in mind for avoiding the malloc just ...
7 years, 1 month ago (2013-11-13 14:02:30 UTC) #1
davve
Side-note: HTMLElementStack::hasOnlyOneElement looks like a candidate for inlining (now).
7 years, 1 month ago (2013-11-13 14:28:52 UTC) #2
eseidel
This is OK, but I Think better would be to just keep m_adjustedCurrentStackItemForFragment as a ...
7 years, 1 month ago (2013-11-14 01:49:43 UTC) #3
eseidel
Thanks for writing this up. Sorry I was slow to review.
7 years, 1 month ago (2013-11-14 01:50:01 UTC) #4
davve
On 2013/11/14 01:49:43, eseidel wrote: > This is OK, but I Think better would be ...
7 years, 1 month ago (2013-11-14 06:05:14 UTC) #5
eseidel
We could also just include a stack-allocated ajusted stackitem? Or can't we just return m_stack[0]? ...
7 years, 1 month ago (2013-11-14 06:44:47 UTC) #6
eseidel
Keeping innerHTML down to the minimum number of mallocs is actually important. When we very ...
7 years, 1 month ago (2013-11-14 06:46:20 UTC) #7
esprehn
On 2013/11/14 06:46:20, eseidel wrote: > [...] at one point we special cased innerHTML='text' or ...
7 years, 1 month ago (2013-11-14 06:54:13 UTC) #8
eseidel
We could do better than that though. We could short-cut earlier by scanning the innerHTML ...
7 years, 1 month ago (2013-11-14 07:02:15 UTC) #9
davve
On 2013/11/14 06:44:47, eseidel wrote: > We could also just include a stack-allocated ajusted stackitem? ...
7 years, 1 month ago (2013-11-14 07:19:09 UTC) #10
eseidel
Yeah, that's one example of the crazy we had to add in order to keep ...
7 years, 1 month ago (2013-11-14 07:24:15 UTC) #11
eseidel
Yeah, that's one example of the crazy we had to add in order to keep ...
7 years, 1 month ago (2013-11-14 07:24:15 UTC) #12
davve
I've conducted some performance measurements comparing before/after this patch. The short test is: <script> var ...
7 years, 1 month ago (2013-11-14 11:46:25 UTC) #13
eseidel
lgtm Definitely better. https://codereview.chromium.org/68893014/diff/100001/Source/core/html/parser/HTMLTreeBuilder.cpp File Source/core/html/parser/HTMLTreeBuilder.cpp (left): https://codereview.chromium.org/68893014/diff/100001/Source/core/html/parser/HTMLTreeBuilder.cpp#oldcode343 Source/core/html/parser/HTMLTreeBuilder.cpp:343: , m_contextElement(0) Oh, I love it. ...
7 years, 1 month ago (2013-11-14 15:39:41 UTC) #14
eseidel
Testing procedure sgtm. You invented your own microbenchmark, because you're fixing something very microbenchmarkable -- ...
7 years, 1 month ago (2013-11-14 15:42:58 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davve@opera.com/68893014/210001
7 years, 1 month ago (2013-11-14 20:23:07 UTC) #16
davve
On 2013/11/14 15:39:41, eseidel wrote: > lgtm > > Definitely better. Thanks for your help! ...
7 years, 1 month ago (2013-11-14 20:26:39 UTC) #17
commit-bot: I haz the power
7 years, 1 month ago (2013-11-14 21:32:19 UTC) #18
Message was sent while issue was closed.
Change committed as 162047

Powered by Google App Engine
This is Rietveld 408576698