RESOLVED FIXED 99884
[V8] Vastly simplify V8GCController's NodeVisitor
https://bugs.webkit.org/show_bug.cgi?id=99884
Summary [V8] Vastly simplify V8GCController's NodeVisitor
Adam Barth
Reported 2012-10-19 16:20:14 PDT
[V8] Vastly simplify V8GCController's NodeVisitor
Attachments
Patch (9.73 KB, patch)
2012-10-19 16:22 PDT, Adam Barth
no flags
Updated patch with new PerformanceTests (12.25 KB, patch)
2012-10-20 18:08 PDT, Adam Barth
no flags
perf test results (first five are with patch; last five are without) (44.79 KB, text/html)
2012-10-20 18:09 PDT, Adam Barth
no flags
Updated patch with new PerformanceTests (12.91 KB, patch)
2012-10-20 18:17 PDT, Adam Barth
no flags
gc-mini-tree (first three are with patch; last three are without) (27.91 KB, text/html)
2012-10-20 18:18 PDT, Adam Barth
no flags
Patch (11.09 KB, patch)
2012-10-20 18:29 PDT, Adam Barth
abarth: review-
Patch (10.88 KB, patch)
2012-10-20 23:05 PDT, Adam Barth
no flags
Patch for landing (12.69 KB, patch)
2012-10-22 11:19 PDT, Adam Barth
no flags
Patch for landing (12.73 KB, patch)
2012-10-22 11:21 PDT, Adam Barth
no flags
Perf test results (first five are without patch; second five are with patch) (56.86 KB, text/html)
2012-10-22 11:24 PDT, Adam Barth
no flags
Adam Barth
Comment 1 2012-10-19 16:22:09 PDT
Adam Barth
Comment 2 2012-10-19 16:35:49 PDT
I didn't mention this in the ChangeLog, but I also got rid of an entire memcpy.
Eric Seidel (no email)
Comment 3 2012-10-19 19:31:39 PDT
Comment on attachment 169718 [details] Patch On heavy-GC tests, this should show a speed win, no?
Kentaro Hara
Comment 4 2012-10-19 19:38:52 PDT
Comment on attachment 169718 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169718&action=review Looks good at a first glance. Let me take a detailed look later. > Source/WebCore/bindings/v8/V8GCController.cpp:136 > + // FIXME: What about <audio>? Are you caring about that <audio> is an active Node?
Adam Barth
Comment 5 2012-10-19 20:53:54 PDT
(In reply to comment #4) > (From update of attachment 169718 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=169718&action=review > > Looks good at a first glance. Let me take a detailed look later. > > > Source/WebCore/bindings/v8/V8GCController.cpp:136 > > + // FIXME: What about <audio>? > > Are you caring about that <audio> is an active Node? Oh, you're right. <audio> inherits from HTMLMediaElement. I'll remove the comment.
Adam Barth
Comment 6 2012-10-19 20:54:25 PDT
> On heavy-GC tests, this should show a speed win, no? Yes. We can try it on Kentaro's createElement case if you like.
Eric Seidel (no email)
Comment 7 2012-10-20 15:49:39 PDT
I would like to see the perf results if possible. On whatever benchmark you like of course.
Adam Barth
Comment 8 2012-10-20 18:08:51 PDT
Created attachment 169779 [details] Updated patch with new PerformanceTests
Adam Barth
Comment 9 2012-10-20 18:09:41 PDT
Created attachment 169780 [details] perf test results (first five are with patch; last five are without)
Adam Barth
Comment 10 2012-10-20 18:17:14 PDT
Created attachment 169781 [details] Updated patch with new PerformanceTests
Adam Barth
Comment 11 2012-10-20 18:18:42 PDT
Created attachment 169782 [details] gc-mini-tree (first three are with patch; last three are without) Just for fun, I added a third PerformanceTest with a workload that shows the new algorithm running 20% faster than the old algorithm.
Adam Barth
Comment 12 2012-10-20 18:29:15 PDT
Adam Barth
Comment 13 2012-10-20 20:22:05 PDT
Comment on attachment 169783 [details] Patch Looks like I broke some tests. :(
Eric Seidel (no email)
Comment 14 2012-10-20 20:30:43 PDT
Comment on attachment 169783 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169783&action=review > Source/WebCore/bindings/v8/V8GCController.cpp:136 > + // FIXME: What about <audio>? What's this about? > Source/WebCore/bindings/v8/V8GCController.cpp:147 > + while (Node* parent = node->parentOrHostNode()) > + node = parent; Don't we already have a function for this? > Source/WebCore/bindings/v8/V8GCController.cpp:170 > +bool operator<(const ImplicitReference& lhs, const ImplicitReference& rhs) > +{ > + return lhs.root() < rhs.root(); I would have named these "left" and "right" > Source/WebCore/bindings/v8/V8GCController.cpp:208 > + currentGroup.shrink(0); Why? And if so, why not have the Vector declared in the for loop block?
Adam Barth
Comment 15 2012-10-20 20:41:19 PDT
(In reply to comment #14) > (From update of attachment 169783 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=169783&action=review > > > Source/WebCore/bindings/v8/V8GCController.cpp:136 > > + // FIXME: What about <audio>? > > What's this about? Kentaro pointed out in Comment #4 that <audio> is fine because it's a subclass of HTMLMediaElement, which is an ActiveDOMObject. > > Source/WebCore/bindings/v8/V8GCController.cpp:147 > > + while (Node* parent = node->parentOrHostNode()) > > + node = parent; > > Don't we already have a function for this? Not that I know of. > > Source/WebCore/bindings/v8/V8GCController.cpp:170 > > +bool operator<(const ImplicitReference& lhs, const ImplicitReference& rhs) > > +{ > > + return lhs.root() < rhs.root(); > > I would have named these "left" and "right" > > > Source/WebCore/bindings/v8/V8GCController.cpp:208 > > + currentGroup.shrink(0); > > Why? And if so, why not have the Vector declared in the for loop block? That's the trick that saves 20% on gc-mini-tree. If we declared the vector in the for loop block, we'd have to malloc it every time. Using shrink lets us re-use the buffer for each iteration.
Adam Barth
Comment 16 2012-10-20 23:05:18 PDT
Adam Barth
Comment 17 2012-10-21 09:59:22 PDT
I should re-run the benchmarks with the updated patch. I'm sure it's not a regression. I'm just not sure if mini-tree will show the same improvement.
Kentaro Hara
Comment 18 2012-10-21 23:45:48 PDT
Comment on attachment 169786 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169786&action=review Looks OK. Please just re-run the benchmarks and verify the speed-up. > PerformanceTests/ChangeLog:12 > + * Bindings/gc-forest.html: Added. > + * Bindings/gc-mini-tree.html: Added. > + * Bindings/gc-tree.html: Added. It looks like you missed adding these tests.
Adam Barth
Comment 19 2012-10-22 11:19:25 PDT
Created attachment 169943 [details] Patch for landing
Adam Barth
Comment 20 2012-10-22 11:21:33 PDT
Created attachment 169944 [details] Patch for landing
Adam Barth
Comment 21 2012-10-22 11:24:14 PDT
Created attachment 169945 [details] Perf test results (first five are without patch; second five are with patch) Here's a summary of the perf tests results (average of five runs): gc-forest: 1.14% better gc-mini-tree: 5.09% better gc-tree: 4.60% better The performance improvements are icing on this patch (in my view). The main thing I wanted to do here is to delete the nutty code. :)
WebKit Review Bot
Comment 22 2012-10-22 11:50:21 PDT
Comment on attachment 169944 [details] Patch for landing Clearing flags on attachment: 169944 Committed r132114: <http://trac.webkit.org/changeset/132114>
WebKit Review Bot
Comment 23 2012-10-22 11:50:26 PDT
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.