RESOLVED INVALID 61771
Unnecessary condition checks in HTMLTreeBuilder when not parsing fragment
https://bugs.webkit.org/show_bug.cgi?id=61771
Summary Unnecessary condition checks in HTMLTreeBuilder when not parsing fragment
Balazs Kelemen
Reported 2011-05-31 01:22:13 PDT
Let me give an example: // FIXME: This is slow. if (!m_tree.openElements()->inTableScope(tbodyTag.localName()) && !m_tree.openElements()->inTableScope(theadTag.localName()) && !m_tree.openElements()->inTableScope(tfootTag.localName())) { ASSERT(isParsingFragment()); parseError(token); return; } In release builds there is no reason for evaluating the condition if not parsing fragment because it must never be true.
Attachments
patch (16.46 KB, patch)
2011-05-31 01:43 PDT, Balazs Kelemen
no flags
Patch (11.31 KB, patch)
2011-05-31 07:44 PDT, Balazs Kelemen
abarth: review-
Balazs Kelemen
Comment 1 2011-05-31 01:43:38 PDT
Balazs Kelemen
Comment 2 2011-05-31 07:26:43 PDT
Comment on attachment 95406 [details] patch This does not work with expressions that have side effect. Need to revert such changes.
Balazs Kelemen
Comment 3 2011-05-31 07:44:11 PDT
Adam Barth
Comment 4 2011-05-31 12:50:40 PDT
Comment on attachment 95432 [details] Patch Does this have a measurable effect on performance? You can try using these benchmarks: http://trac.webkit.org/browser/trunk/PerformanceTests/Parser (Marking R- for now, but feel free to renominate.)
Alexey Proskuryakov
Comment 5 2011-05-31 15:39:02 PDT
I'm not sure if adding the macro is so great. It suddenly exposes readers of the code to non-C++ syntax that's only used in this file. Learning a new syntax costs a lot!
Balazs Kelemen
Comment 6 2011-06-02 09:24:29 PDT
No gain on the html5 parser test.
Note You need to log in before you can comment on or make changes to this bug.