<?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>234940</bug_id>
          
          <creation_ts>2022-01-06 17:16:49 -0800</creation_ts>
          <short_desc>DataURLResourceMediaLoader decodes the URL repeatedly during a video playback</short_desc>
          <delta_ts>2022-01-18 12:42:07 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=235325</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Peng Liu">peng.liu6</reporter>
          <assigned_to name="Peng Liu">peng.liu6</assigned_to>
          <cc>darin</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>jean-yves.avenard</cc>
    
    <cc>jer.noble</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1828783</commentid>
    <comment_count>0</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-06 17:16:49 -0800</bug_when>
    <thetext>DataURLResourceMediaLoader decodes the URL repeatedly during a video playback</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1828787</commentid>
    <comment_count>1</comment_count>
      <attachid>448550</attachid>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-06 17:37:11 -0800</bug_when>
    <thetext>Created attachment 448550
[fast-cq] Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1828788</commentid>
    <comment_count>2</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-06 17:38:06 -0800</bug_when>
    <thetext>&lt;rdar://83925935&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1828798</commentid>
    <comment_count>3</comment_count>
      <attachid>448550</attachid>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2022-01-06 18:27:01 -0800</bug_when>
    <thetext>Comment on attachment 448550
[fast-cq] Patch

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

&gt; Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:365
&gt; +        if (!m_dataURLMediaLoader &amp;&amp; [contentInfo respondsToSelector:@selector(setEntireLengthAvailableOnDemand:)])

couldn&apos;t we cache the URL decoding instead and re-use that ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1828925</commentid>
    <comment_count>4</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-07 09:00:40 -0800</bug_when>
    <thetext>(In reply to Jean-Yves Avenard [:jya] from comment #3)
&gt; Comment on attachment 448550 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=448550&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:365
&gt; &gt; +        if (!m_dataURLMediaLoader &amp;&amp; [contentInfo respondsToSelector:@selector(setEntireLengthAvailableOnDemand:)])
&gt; 
&gt; couldn&apos;t we cache the URL decoding instead and re-use that ?

Actually, this is what this patch does. AVFoundation caches the decoded result internally. Some refactoring is needed if we want to cache the result in WebKit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829869</commentid>
    <comment_count>5</comment_count>
      <attachid>448550</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-01-11 11:19:59 -0800</bug_when>
    <thetext>Comment on attachment 448550
[fast-cq] Patch

Can we find a way to test this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829937</commentid>
    <comment_count>6</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-11 15:22:37 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #5)
&gt; Comment on attachment 448550 [details]
&gt; Patch
&gt; 
&gt; Can we find a way to test this?

This patch fixes a performance issue. I manually tested it. But I am not sure we can add a reliable regression test for it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829939</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-01-11 15:26:24 -0800</bug_when>
    <thetext>Committed r287899 (245936@main): &lt;https://commits.webkit.org/245936@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 448550.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829959</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-01-11 16:34:13 -0800</bug_when>
    <thetext>We have other tests for performance issues. I’m surprised to hear we can’t make a test for this one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829966</commentid>
    <comment_count>9</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-11 17:04:54 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #8)
&gt; We have other tests for performance issues. I’m surprised to hear we can’t
&gt; make a test for this one.

Do you mean regression tests which run automatically on bots?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829971</commentid>
    <comment_count>10</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-01-11 17:41:00 -0800</bug_when>
    <thetext>Yes. There are a few in LayoutTests/perf for example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1830151</commentid>
    <comment_count>11</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-12 08:59:30 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #10)
&gt; Yes. There are a few in LayoutTests/perf for example.

Thanks! These tests look useful!

However, the test for this patch is more difficult. Because the performance issue is related to AVFoundation&apos;s internal behavior, and there is no obvious way to get the performance difference (before and after applying this patch) from JS code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1830187</commentid>
    <comment_count>12</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-01-12 09:59:01 -0800</bug_when>
    <thetext>I’m willing to accept no for an answer.

But I really don’t understand why we can’t create a test; every kind of test we have originally did not exist, and was invented because we needed to protect the performance or reliability of WebKit in the long run. Presumably we can make a huge stress test case where the performance impact is very obvious, and make a way to run it.

Given the fix here is subtle, and depends on both WebKit and AVFoundation, I think it’s really risky to just make the fix without creating a regression test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1831771</commentid>
    <comment_count>13</comment_count>
    <who name="Peng Liu">peng.liu6</who>
    <bug_when>2022-01-18 12:42:07 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #12)
&gt; I’m willing to accept no for an answer.
&gt; 
&gt; But I really don’t understand why we can’t create a test; every kind of test
&gt; we have originally did not exist, and was invented because we needed to
&gt; protect the performance or reliability of WebKit in the long run. Presumably
&gt; we can make a huge stress test case where the performance impact is very
&gt; obvious, and make a way to run it.
&gt; 
&gt; Given the fix here is subtle, and depends on both WebKit and AVFoundation, I
&gt; think it’s really risky to just make the fix without creating a regression
&gt; test.

I am working on a regression test now. Eric and Jer provided some good suggestions.
https://bugs.webkit.org/show_bug.cgi?id=235325</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>448550</attachid>
            <date>2022-01-06 17:37:11 -0800</date>
            <delta_ts>2022-01-11 15:26:26 -0800</delta_ts>
            <desc>[fast-cq] Patch</desc>
            <filename>bug-234940-20220106173710.patch</filename>
            <type>text/plain</type>
            <size>2991</size>
            <attacher name="Peng Liu">peng.liu6</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjg3NjcyCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggMmVmZDZkNDY3NWVlYTcx
ODdlN2YzMzA4YjFkN2JiNzY3OWNlZjZhOS4uNWQzZTY1ZjIxZDgxZjNkMzNmOTAzZjI5YWU5ODVk
YjZmYTI1YTAwOCAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDI0IEBACisyMDIyLTAxLTA2ICBQZW5n
IExpdSAgPHBlbmcubGl1NkBhcHBsZS5jb20+CisKKyAgICAgICAgRGF0YVVSTFJlc291cmNlTWVk
aWFMb2FkZXIgZGVjb2RlcyB0aGUgVVJMIHJlcGVhdGVkbHkgZHVyaW5nIGEgdmlkZW8gcGxheWJh
Y2sKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTIzNDk0
MAorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIEluIHIy
NjQ4NjQsIHdlIGFkb3B0ZWQgYSBuZXcgU1BJIHRvIHRlbGwgQVZGb3VuZGF0aW9uIHRoYXQgdGhl
IGVudGlyZSBmaWxlIGlzIGF2YWlsYWJsZSBmb3IgY3VzdG9tIFVSTHMuCisgICAgICAgIEFzIGEg
cmVzdWx0LCBkdXJpbmcgYSB2aWRlbyBwbGF5YmFjaywgQVZGb3VuZGF0aW9uIHdpbGwgcmVxdWVz
dCBzbWFsbCBkYXRhIHJhbmdlcyBpbnN0ZWFkIG9mICJjYWNoaW5nIgorICAgICAgICB0aGUgd2hv
bGUgZmls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