NEW209667
Optimize frequently used Document::canAcceptChild
https://bugs.webkit.org/show_bug.cgi?id=209667
Summary Optimize frequently used Document::canAcceptChild
Eugene But
Reported 2020-03-27 11:07:57 PDT
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
Darin Adler
Comment 1 2020-03-27 11:27:37 PDT
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.
Note You need to log in before you can comment on or make changes to this bug.