Bug 209667
| Summary: | Optimize frequently used Document::canAcceptChild | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Eugene But <eugenebut> |
| Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Minor | CC: | darin |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | All | ||
Eugene But
This came up during the codereview here: https://bugs.webkit.org/show_bug.cgi?id=208311#c53
Darin Adler said:
"Can’t help noticing that this function is not written with efficiency in mind. The nodeType virtual function is pretty expensive and we call it 3 times!"
and
"this can be optimized for all the common cases to not call nodeType at all, using functions like isElementNode and isTextNode that are inline single bit checks. Only exotic cases would require calls to nodeType."
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Darin Adler
I do want to be a bit cautious about not complicating this to optimize it if there’s no evidence a faster version would make any practical difference. So maybe we shouldn’t do it even though I suggested it. Would be easy to do, though.