WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
107150
BackgroundHTMLParser shouldn't create AtomicStrings
https://bugs.webkit.org/show_bug.cgi?id=107150
Summary
BackgroundHTMLParser shouldn't create AtomicStrings
Adam Barth
Reported
2013-01-17 11:52:59 PST
BackgroundHTMLParser shouldn't make an extra copy of every tag name
Attachments
Patch
(8.92 KB, patch)
2013-01-17 11:56 PST
,
Adam Barth
no flags
Details
Formatted Diff
Diff
Patch
(8.99 KB, patch)
2013-01-17 12:04 PST
,
Adam Barth
no flags
Details
Formatted Diff
Diff
rebase to TOT
(9.13 KB, patch)
2013-01-17 17:26 PST
,
Adam Barth
no flags
Details
Formatted Diff
Diff
works---not for review
(5.80 KB, patch)
2013-01-17 18:49 PST
,
Adam Barth
no flags
Details
Formatted Diff
Diff
Patch
(7.54 KB, patch)
2013-01-18 12:36 PST
,
Adam Barth
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Adam Barth
Comment 1
2013-01-17 11:56:42 PST
Created
attachment 183236
[details]
Patch
Eric Seidel (no email)
Comment 2
2013-01-17 11:59:29 PST
Comment on
attachment 183236
[details]
Patch Do we know if this is faster? And do we have any good way to catch that w'ere not using regular equal with these tags? HTMLNames is really dangerous to have on this background thread. (Also this code is still wrong wrt namespaces, but that's a separate bug.)
Adam Barth
Comment 3
2013-01-17 11:59:32 PST
Comment on
attachment 183236
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=183236&action=review
> Source/WebCore/ChangeLog:10 > + Previously, we were creating an AtomicString from the HTMLToken for > + every start and end tag. This caused us to allocate a new StringImpl > + and memcpy the start and end tag names an extra time.
I guess this isn't quite true since AtomicString will atomize them.
Adam Barth
Comment 4
2013-01-17 12:02:30 PST
> Do we know if this is faster?
Tony is still upstreaming your work from last night, so I haven't been able to run the performance test. In general, though, I don't think we should be creating AtomicStrings on the background thread. That creates a static dependency, which will block integration with libdispatch later.
> And do we have any good way to catch that w'ere not using regular equal with these tags?
Nope. We need to be careful with how we're using HTMLNames.
> Also this code is still wrong wrt namespaces, but that's a separate bug.
Yes, this patch does not attempt to address that bug.
Adam Barth
Comment 5
2013-01-17 12:04:39 PST
Created
attachment 183239
[details]
Patch
Adam Barth
Comment 6
2013-01-17 12:05:14 PST
I've adjusted the ChangeLog to motivate the change without referencing performance.
Eric Seidel (no email)
Comment 7
2013-01-17 12:08:09 PST
Comment on
attachment 183239
[details]
Patch I'm still concerned about using HTMLNames w/o any ASSERT protections. :) And I would still like to know what the perf impact is. run-perf-tests parser/html-parser-srcdoc.html should show a difference. :) I guess we should just rename that to -threaded, and have it force on the threaded parser.
Adam Barth
Comment 8
2013-01-17 12:09:11 PST
We can wait on this patch until we finish upstreaming the branch if you like.
Adam Barth
Comment 9
2013-01-17 17:26:32 PST
Created
attachment 183325
[details]
rebase to TOT
Adam Barth
Comment 10
2013-01-17 18:49:26 PST
Created
attachment 183348
[details]
works---not for review
Adam Barth
Comment 11
2013-01-17 18:56:09 PST
I need to study it more carefully, but this patch does not appear to have a performance impact on the srcdoc benchmark.
Eric Seidel (no email)
Comment 12
2013-01-17 18:59:44 PST
Our benchmark probably needs improvement (we still don't really keep the main thread very busy). But I suspect that this stuff is also rather subtle, and as you say, just need more study.
Adam Barth
Comment 13
2013-01-18 12:18:35 PST
This looks like it saves around ~10% of the time on the parser thread. I'm going to clean it up for review.
Adam Barth
Comment 14
2013-01-18 12:26:25 PST
Running the parser-srcdoc benchmark with the patch in
bug 107236
applied: == With patch == Running Time Self Symbol Name 12129.0ms 76.4% 0.0 Main Thread 0x878fe 3628.0ms 22.8% 0.0 WebCore::HTMLParserThread::runLoop 0x8792f == Without patch == Running Time Self Symbol Name 11846.0ms 73.9% 0.0 Main Thread 0x87b04 4100.0ms 25.5% 0.0 WebCore::HTMLParserThread::runLoop 0x87b28 That's a 2.3% savings on the main thread and an 11.5% savings on the background thread.
Adam Barth
Comment 15
2013-01-18 12:36:39 PST
Created
attachment 183526
[details]
Patch
Eric Seidel (no email)
Comment 16
2013-01-18 12:49:30 PST
I assume that you also saw a total reduction in time when instruments was not running? :)
Adam Barth
Comment 17
2013-01-18 14:00:08 PST
(In reply to
comment #16
)
> I assume that you also saw a total reduction in time when instruments was not running? :)
== With patch == avg 464.88400000016554 ms median 431.9385000017064 ms stdev 131.61021047785155 ms == Without patch == avg 477.63914999995905 ms median 443.0915000011737 ms stdev 138.40526205197622 ms Result: 2.6% faster
WebKit Review Bot
Comment 18
2013-01-18 15:16:44 PST
Comment on
attachment 183526
[details]
Patch Clearing flags on attachment: 183526 Committed
r140212
: <
http://trac.webkit.org/changeset/140212
>
WebKit Review Bot
Comment 19
2013-01-18 15:16:48 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug