RESOLVED FIXED 138376
Use lambda functions in DocumentOrderedMap
https://bugs.webkit.org/show_bug.cgi?id=138376
Summary Use lambda functions in DocumentOrderedMap
Chris Dumez
Reported 2014-11-04 14:34:29 PST
Use lambda functions in DocumentOrderedMap instead of templates and separate named functions.
Attachments
Patch (8.72 KB, patch)
2014-11-04 15:15 PST, Chris Dumez
no flags
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 (552.65 KB, application/zip)
2014-11-04 17:12 PST, Build Bot
no flags
Patch (8.65 KB, patch)
2014-11-04 17:28 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2014-11-04 15:15:27 PST
WebKit Commit Bot
Comment 2 2014-11-04 15:18:25 PST
Attachment 240958 [details] did not pass style-queue: ERROR: Source/WebCore/dom/DocumentOrderedMap.h:71: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3 2014-11-04 15:21:34 PST
Comment on attachment 240958 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=240958&action=review > Source/WebCore/dom/DocumentOrderedMap.cpp:88 > +inline Element* DocumentOrderedMap::get(const AtomicStringImpl& key, const TreeScope& scope, KeyMatchingFunction keyMatches) const Seems like this might not get inlined as much as it did before. Are you sure there is no performance problem introduced here?
Chris Dumez
Comment 4 2014-11-04 15:24:28 PST
Comment on attachment 240958 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=240958&action=review >> Source/WebCore/dom/DocumentOrderedMap.cpp:88 >> +inline Element* DocumentOrderedMap::get(const AtomicStringImpl& key, const TreeScope& scope, KeyMatchingFunction keyMatches) const > > Seems like this might not get inlined as much as it did before. Are you sure there is no performance problem introduced here? Hmm, this may be an issue indeed. I will verify.
Ryosuke Niwa
Comment 5 2014-11-04 16:06:18 PST
Did you run perf tests for this?
Chris Dumez
Comment 6 2014-11-04 16:21:23 PST
(In reply to comment #5) > Did you run perf tests for this? I will, as pointed out by Darin, it is likely I'll need to keep the function templated. However, we can still use lambdas.
Build Bot
Comment 7 2014-11-04 17:12:34 PST
Created attachment 240985 [details] Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-09 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Chris Dumez
Comment 8 2014-11-04 17:17:56 PST
Comment on attachment 240958 [details] Patch I confirmed this regresses performance (~8% on getElementById). I'll re-upload a version keeping the function templated.
Chris Dumez
Comment 9 2014-11-04 17:28:37 PST
Chris Dumez
Comment 10 2014-11-04 17:32:06 PST
I have confirmed that this new version does not regress performance. getElementById() actually seems to be ~2% faster now although I am not sure why.
Chris Dumez
Comment 11 2014-11-05 09:34:50 PST
I set the review flag again as the changes to the patch after the review were non-trivial.
Darin Adler
Comment 12 2014-11-06 07:22:08 PST
Comment on attachment 240990 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=240990&action=review > Source/WebCore/dom/DocumentOrderedMap.h:72 > + template <typename KeyMatchingFunction> > + Element* get(const AtomicStringImpl&, const TreeScope&, const KeyMatchingFunction&) const; I know we often format function template declarations like this on two lines, but I find it hard to see the structure here, with both lines flush left, but the second actually a continuation of the first. That’s why I prefer putting these into a single line, even if it makes the line long.
WebKit Commit Bot
Comment 13 2014-11-06 08:00:23 PST
Comment on attachment 240990 [details] Patch Clearing flags on attachment: 240990 Committed r175697: <http://trac.webkit.org/changeset/175697>
WebKit Commit Bot
Comment 14 2014-11-06 08:00:28 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.