<?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>137721</bug_id>
          
          <creation_ts>2014-10-14 15:05:30 -0700</creation_ts>
          <short_desc>[Mac] Fix inefficiencies in ResourceResponse::platformLazyInit(InitLevel)</short_desc>
          <delta_ts>2014-10-15 17:10:08 -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>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>ap</cc>
    
    <cc>barraclough</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1041697</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-14 15:05:30 -0700</bug_when>
    <thetext>There are several inefficiencies with the current Mac implementation of ResourceResponse::platformLazyInit(InitLevel):
1. We end up initializing uncommon fields even if called with CommonFieldsOnly initLevel.
2. If called with AllFields initLevel (if currently uninitialized), we end up populating m_httpHeaderFields twice, once with only the common headers, then with ALL the headers. We can skip the common-header case in this case to avoid wasting CPU time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041699</commentid>
    <comment_count>1</comment_count>
      <attachid>239828</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-14 15:23:24 -0700</bug_when>
    <thetext>Created attachment 239828
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041730</commentid>
    <comment_count>2</comment_count>
      <attachid>239828</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2014-10-14 17:02:32 -0700</bug_when>
    <thetext>Comment on attachment 239828
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041744</commentid>
    <comment_count>3</comment_count>
      <attachid>239828</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-10-14 17:44:48 -0700</bug_when>
    <thetext>Comment on attachment 239828
Patch

Clearing flags on attachment: 239828

Committed r174717: &lt;http://trac.webkit.org/changeset/174717&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041745</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-10-14 17:46:22 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041868</commentid>
    <comment_count>5</comment_count>
      <attachid>239828</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-10-15 09:30:35 -0700</bug_when>
    <thetext>Comment on attachment 239828
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239828&amp;action=review

&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:141
&gt; +                for (unsigned i = 0; i &lt; WTF_ARRAY_LENGTH(commonHeaderFields); ++i) {

This could use a modern C++ for loop and avoid the need to use WTF_ARRAY_LENGTH.

&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:143
&gt; +                        m_httpHeaderFields.set(String(commonHeaderFields[i]), headerValue);

I’m surprised we need the explicit String() here. Also, it would be a bit more efficient to create this String if we used ASCIILiteral. And in additional, HashMap::add generates slightly less code than set, which is an add followed by an optional assignment, and here we could use either, so I suggest we use add.

&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:164
&gt;                  m_httpHeaderFields.set(String(name), [headers objectForKey:name]);

I’m surprised we need the explicit String() here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041903</commentid>
    <comment_count>6</comment_count>
      <attachid>239828</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-15 11:10:48 -0700</bug_when>
    <thetext>Comment on attachment 239828
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239828&amp;action=review

&gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:141
&gt;&gt; +                for (unsigned i = 0; i &lt; WTF_ARRAY_LENGTH(commonHeaderFields); ++i) {
&gt; 
&gt; This could use a modern C++ for loop and avoid the need to use WTF_ARRAY_LENGTH.

Right.

&gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:143
&gt;&gt; +                        m_httpHeaderFields.set(String(commonHeaderFields[i]), headerValue);
&gt; 
&gt; I’m surprised we need the explicit String() here. Also, it would be a bit more efficient to create this String if we used ASCIILiteral. And in additional, HashMap::add generates slightly less code than set, which is an add followed by an optional assignment, and here we could use either, so I suggest we use add.

I don&apos;t think ASCIILiteral works here. Right now, we have an array of NSString*, so using a modern loop would look like for (NSString* name : commonHeaderFields). I cannot call ASCIILIteral(NSString*). It is an NSString* because it is used in [headers objectForKey:name].

Regarding the second comment. The issue is that m_httpHeaderFields is not a HashMap, it is an HTTPHeaderMap. HTTPHeaderMap::add() actually does more work because if the key is already present, it will *append* the new value to the existing value. So, either way, we end up checking !result.isNewEntry (which is never true because we clear the HashMap before this loop) and we return without further value change. In the end it is equivalent performance-wise but I think HTTPHeaderMap::add() is clearer here because we really want to set the header value, not append the new value to the existing one.

&gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:164
&gt;&gt;                  m_httpHeaderFields.set(String(name), [headers objectForKey:name]);
&gt; 
&gt; I’m surprised we need the explicit String() here.

We don&apos;t. As a matter of fact, if that constructor was explicit, we would need String([headers objectForKey:name]) as well.

Also note that we could not use HTTPHeaderMap::add() here because common headers might already be in the HashMap and we would end up appending / duplicating the value, instead of overwriting it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041904</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-15 11:13:18 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; (From update of attachment 239828 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=239828&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:141
&gt; &gt;&gt; +                for (unsigned i = 0; i &lt; WTF_ARRAY_LENGTH(commonHeaderFields); ++i) {
&gt; &gt; 
&gt; &gt; This could use a modern C++ for loop and avoid the need to use WTF_ARRAY_LENGTH.
&gt; 
&gt; Right.
&gt; 
&gt; &gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:143
&gt; &gt;&gt; +                        m_httpHeaderFields.set(String(commonHeaderFields[i]), headerValue);
&gt; &gt; 
&gt; &gt; I’m surprised we need the explicit String() here. Also, it would be a bit more efficient to create this String if we used ASCIILiteral. And in additional, HashMap::add generates slightly less code than set, which is an add followed by an optional assignment, and here we could use either, so I suggest we use add.
&gt; 
&gt; I don&apos;t think ASCIILiteral works here. Right now, we have an array of NSString*, so using a modern loop would look like for (NSString* name : commonHeaderFields). I cannot call ASCIILIteral(NSString*). It is an NSString* because it is used in [headers objectForKey:name].
&gt; 
&gt; Regarding the second comment. The issue is that m_httpHeaderFields is not a HashMap, it is an HTTPHeaderMap. HTTPHeaderMap::add() actually does more work because if the key is already present, it will *append* the new value to the existing value. So, either way, we end up checking !result.isNewEntry (which is never true because we clear the HashMap before this loop) and we return without further value change. In the end it is equivalent performance-wise but I think HTTPHeaderMap::add() is clearer here because we really want to set the header value, not append the new value to the existing one.

typo: I meant &quot;HTTPHeaderMap::set() is clearer*</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041905</commentid>
    <comment_count>8</comment_count>
      <attachid>239879</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-15 11:16:28 -0700</bug_when>
    <thetext>Created attachment 239879
Follow-up patch for nits.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041928</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-15 12:59:07 -0700</bug_when>
    <thetext>Reopening to fix nits.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041998</commentid>
    <comment_count>10</comment_count>
      <attachid>239828</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-10-15 16:15:08 -0700</bug_when>
    <thetext>Comment on attachment 239828
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239828&amp;action=review

&gt;&gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:143
&gt;&gt;&gt; +                        m_httpHeaderFields.set(String(commonHeaderFields[i]), headerValue);
&gt;&gt; 
&gt;&gt; I’m surprised we need the explicit String() here. Also, it would be a bit more efficient to create this String if we used ASCIILiteral. And in additional, HashMap::add generates slightly less code than set, which is an add followed by an optional assignment, and here we could use either, so I suggest we use add.
&gt; 
&gt; I don&apos;t think ASCIILiteral works here. Right now, we have an array of NSString*, so using a modern loop would look like for (NSString* name : commonHeaderFields). I cannot call ASCIILIteral(NSString*). It is an NSString* because it is used in [headers objectForKey:name].
&gt; 
&gt; Regarding the second comment. The issue is that m_httpHeaderFields is not a HashMap, it is an HTTPHeaderMap. HTTPHeaderMap::add() actually does more work because if the key is already present, it will *append* the new value to the existing value. So, either way, we end up checking !result.isNewEntry (which is never true because we clear the HashMap before this loop) and we return without further value change. In the end it is equivalent performance-wise but I think HTTPHeaderMap::add() is clearer here because we really want to set the header value, not append the new value to the existing one.

Makes sense, my comment was about HashMap::set, not about HTTPHeaderMap::set!

If the performance of this function matters enough, we should consider a separate array containing each of the common header field names in WTF::String form; seems wasteful to convert from NSString to WTF::String each time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042002</commentid>
    <comment_count>11</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2014-10-15 16:24:31 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; (From update of attachment 239828 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=239828&amp;action=review
&gt; 
&gt; &gt;&gt;&gt; Source/WebCore/platform/network/mac/ResourceResponseMac.mm:143
&gt; &gt;&gt;&gt; +                        m_httpHeaderFields.set(String(commonHeaderFields[i]), headerValue);
&gt; &gt;&gt; 
&gt; &gt;&gt; I’m surprised we need the explicit String() here. Also, it would be a bit more efficient to create this String if we used ASCIILiteral. And in additional, HashMap::add generates slightly less code than set, which is an add followed by an optional assignment, and here we could use either, so I suggest we use add.
&gt; &gt; 
&gt; &gt; I don&apos;t think ASCIILiteral works here. Right now, we have an array of NSString*, so using a modern loop would look like for (NSString* name : commonHeaderFields). I cannot call ASCIILIteral(NSString*). It is an NSString* because it is used in [headers objectForKey:name].
&gt; &gt; 
&gt; &gt; Regarding the second comment. The issue is that m_httpHeaderFields is not a HashMap, it is an HTTPHeaderMap. HTTPHeaderMap::add() actually does more work because if the key is already present, it will *append* the new value to the existing value. So, either way, we end up checking !result.isNewEntry (which is never true because we clear the HashMap before this loop) and we return without further value change. In the end it is equivalent performance-wise but I think HTTPHeaderMap::add() is clearer here because we really want to set the header value, not append the new value to the existing one.
&gt; 
&gt; Makes sense, my comment was about HashMap::set, not about HTTPHeaderMap::set!
&gt; 
&gt; If the performance of this function matters enough, we should consider a separate array containing each of the common header field names in WTF::String form; seems wasteful to convert from NSString to WTF::String each time.

I don&apos;t think it is worth it. Based on my investigation, we mostly call this function with AllFields initLevel (rarely CommonFieldsOnly). This is usually triggered by serialization for the IPC between the NetworkProcess and the WebProcess. FYI, what is hot in this function right now is:

m_url = [m_nsResponse.get() URL]; // 7.1%
m_mimeType = [m_nsResponse.get() MIMEType]; // 7.1%
m_expectedContentLength = [m_nsResponse.get() expectedContentLength]; // 7.1%
m_textEncodingName = [m_nsResponse.get() textEncodingName]; // 28.6%

if (RetainPtr&lt;NSString&gt; httpStatusLine = adoptNS(wkCopyNSURLResponseStatusLine(httpResponse))) // 7.1%

for (NSString *name in headers) // 7.1%
    m_httpHeaderFields.set(String(name), [headers objectForKey:name]); // 21.4%
[pool drain]; // 7.1%</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042012</commentid>
    <comment_count>12</comment_count>
      <attachid>239879</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-10-15 17:10:03 -0700</bug_when>
    <thetext>Comment on attachment 239879
Follow-up patch for nits.

Clearing flags on attachment: 239879

Committed r174747: &lt;http://trac.webkit.org/changeset/174747&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042013</commentid>
    <comment_count>13</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-10-15 17:10:08 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>239828</attachid>
            <date>2014-10-14 15:23:24 -0700</date>
            <delta_ts>2014-10-15 16:15:08 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-137721-20141014152329.patch</filename>
            <type>text/plain</type>
            <size>4351</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTc0Njk4CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNTY0N2UyMTk0ZWIxYWQ3
MTZhMTY3MDFkZDE2MDIwY2UwYzQ3ZDEwZC4uY2MyNDEyNWE4NzVhZDRjODMzZTAwYzIyOGY2M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pbiBo
ZWFkZXJzKQogICAgICAgICAgICAgICAgIG1faHR0cEhlYWRlckZpZWxkcy5zZXQoU3RyaW5nKG5h
bWUpLCBbaGVhZGVycyBvYmplY3RGb3JLZXk6bmFtZV0pOwogICAgICAgICAgICAgCiAgICAgICAg
ICAgICBbcG9vbCBkcmFpbl07Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>239879</attachid>
            <date>2014-10-15 11:16:28 -0700</date>
            <delta_ts>2014-10-15 17:10:02 -0700</delta_ts>
            <desc>Follow-up patch for nits.</desc>
            <filename>137721_platformLazyInit_part2.patch</filename>
            <type>text/plain</type>
            <size>2382</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCBiNGYxNTdmLi5lOTMxNTk4IDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDUgKzEsMjEg
QEAKIDIwMTQtMTAtMTUgIENocmlzIER1bWV6ICA8Y2R1bWV6QGFwcGxlLmNvbT4KIAorICAgICAg
ICBbTWFjXSBGaXggaW5lZmZpY2llbmNpZXMgaW4gUmVzb3VyY2VSZXNwb25zZTo6cGxhdGZvcm1M
YXp5SW5pdChJbml0TGV2ZWwpIC0gUGFydCAyCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQu
b3JnL3Nob3dfYnVnLmNnaT9pZD0xMzc3MjEKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkg
KE9PUFMhKS4KKworICAgICAgICBGb2xsb3ctdXAgcGF0Y2ggdG8gcjE3NDcxNyBhZGRyZXNzaW5n
IHJldmlldyBjb21tZW50cyBtYWRlIGFmdGVyIHRoZSBw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c107CiAgICAgICAgICAgICBmb3IgKE5TU3RyaW5nICpuYW1lIGluIGhlYWRl
cnMpCi0gICAgICAgICAgICAgICAgbV9odHRwSGVhZGVyRmllbGRzLnNldChTdHJpbmcobmFtZSks
IFtoZWFkZXJzIG9iamVjdEZvcktleTpuYW1lXSk7CisgICAgICAgICAgICAgICAgbV9odHRwSGVh
ZGVyRmllbGRzLnNldChuYW1lLCBbaGVhZGVycyBvYmplY3RGb3JLZXk6bmFtZV0pOwogICAgICAg
ICAgICAgCiAgICAgICAgICAgICBbcG9vbCBkcmFpbl07CiAgICAgICAgIH0K
</data>

          </attachment>
      

    </bug>

</bugzilla>