<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>209667</bug_id>
          
          <creation_ts>2020-03-27 11:07:57 -0700</creation_ts>
          <short_desc>Optimize frequently used Document::canAcceptChild</short_desc>
          <delta_ts>2020-03-27 11:27:37 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eugene But">eugenebut</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1634888</commentid>
    <comment_count>0</comment_count>
    <who name="Eugene But">eugenebut</who>
    <bug_when>2020-03-27 11:07:57 -0700</bug_when>
    <thetext>This came up during the codereview here: https://bugs.webkit.org/show_bug.cgi?id=208311#c53

Darin Adler said:

&quot;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!&quot;

and

&quot;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.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1634907</commentid>
    <comment_count>1</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-03-27 11:27:37 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>