<?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>217766</bug_id>
          
          <creation_ts>2020-10-15 10:43:05 -0700</creation_ts>
          <short_desc>Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues()</short_desc>
          <delta_ts>2020-10-15 14:16:20 -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>Web Audio</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>212611</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>ggaren</cc>
    
    <cc>glenn</cc>
    
    <cc>jer.noble</cc>
    
    <cc>philipj</cc>
    
    <cc>sam</cc>
    
    <cc>sergio</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1698174</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-10-15 10:43:05 -0700</bug_when>
    <thetext>Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698177</commentid>
    <comment_count>1</comment_count>
      <attachid>411460</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-10-15 10:44:53 -0700</bug_when>
    <thetext>Created attachment 411460
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698179</commentid>
    <comment_count>2</comment_count>
      <attachid>411460</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2020-10-15 10:47:16 -0700</bug_when>
    <thetext>Comment on attachment 411460
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698184</commentid>
    <comment_count>3</comment_count>
      <attachid>411460</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-10-15 11:03:17 -0700</bug_when>
    <thetext>Comment on attachment 411460
Patch

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

&gt; Source/WebCore/ChangeLog:8
&gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().

Does this get us any vectorization or parallelization? I know that’s the long term ambition of the C++ library, they even have std::execution::seq/par/par_unseq/unseq that you can pass as the first argument.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698191</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-10-15 11:11:47 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #3)
&gt; Comment on attachment 411460 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=411460&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt; 
&gt; Does this get us any vectorization or parallelization? I know that’s the
&gt; long term ambition of the C++ library, they even have
&gt; std::execution::seq/par/par_unseq/unseq that you can pass as the first
&gt; argument.

I actually don&apos;t know. I figured the code was more concise with std::fill and we *might* get more optimized code. I guess I could write a simple benchmark to compare the 2.

Also note that we could very easily add a VectorMath function that uses vDSP_fill() [1] to guarantee we get vectorization. What do you think?

[1] https://developer.apple.com/documentation/accelerate/1450501-vdsp_vfill?language=objc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698200</commentid>
    <comment_count>5</comment_count>
      <attachid>411460</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-10-15 11:18:00 -0700</bug_when>
    <thetext>Comment on attachment 411460
Patch

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

&gt;&gt;&gt; Source/WebCore/ChangeLog:8
&gt;&gt;&gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt;&gt; 
&gt;&gt; Does this get us any vectorization or parallelization? I know that’s the long term ambition of the C++ library, they even have std::execution::seq/par/par_unseq/unseq that you can pass as the first argument.
&gt; 
&gt; I actually don&apos;t know. I figured the code was more concise with std::fill and we *might* get more optimized code. I guess I could write a simple benchmark to compare the 2.
&gt; 
&gt; Also note that we could very easily add a VectorMath function that uses vDSP_fill() [1] to guarantee we get vectorization. What do you think?
&gt; 
&gt; [1] https://developer.apple.com/documentation/accelerate/1450501-vdsp_vfill?language=objc

Like most optimization situations, I think:

1) We should optimize if it makes a measurable difference.
2) Outside of that, we should choose an idiom that is both easy to understand and reasonably optimized by default.

I think that using std::fill_n already accomplishes (2) and we could go further if we measure something that shows an optimization opportunity.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698201</commentid>
    <comment_count>6</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2020-10-15 11:18:27 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #4)
&gt; (In reply to Darin Adler from comment #3)
&gt; &gt; Comment on attachment 411460 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=411460&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt; &gt; 
&gt; &gt; Does this get us any vectorization or parallelization? I know that’s the
&gt; &gt; long term ambition of the C++ library, they even have
&gt; &gt; std::execution::seq/par/par_unseq/unseq that you can pass as the first
&gt; &gt; argument.
&gt; 
&gt; I actually don&apos;t know. I figured the code was more concise with std::fill
&gt; and we *might* get more optimized code. I guess I could write a simple
&gt; benchmark to compare the 2.
&gt; 
&gt; Also note that we could very easily add a VectorMath function that uses
&gt; vDSP_fill() [1] to guarantee we get vectorization. What do you think?
&gt; 
&gt; [1]
&gt; https://developer.apple.com/documentation/accelerate/1450501-
&gt; vdsp_vfill?language=objc

I think using accelerate as much as possible in VectorMath is what we should be doing. I really see it as a &quot;platform&quot; abstraction around it.

I still think using std::fill_n here for the non-HAVE(ACCELERATE) case it the right way to go. It doesn&apos;t guarantee any vectorization, but since it is closer the the compiler, if autovectorization is in the compiler, it is more likely the compiler will ensure it works with standard library idioms.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698204</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-10-15 11:20:01 -0700</bug_when>
    <thetext>(In reply to Sam Weinig from comment #6)
&gt; (In reply to Chris Dumez from comment #4)
&gt; &gt; (In reply to Darin Adler from comment #3)
&gt; &gt; &gt; Comment on attachment 411460 [details]
&gt; &gt; &gt; Patch
&gt; &gt; &gt; 
&gt; &gt; &gt; View in context:
&gt; &gt; &gt; https://bugs.webkit.org/attachment.cgi?id=411460&amp;action=review
&gt; &gt; &gt; 
&gt; &gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; &gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt; &gt; &gt; 
&gt; &gt; &gt; Does this get us any vectorization or parallelization? I know that’s the
&gt; &gt; &gt; long term ambition of the C++ library, they even have
&gt; &gt; &gt; std::execution::seq/par/par_unseq/unseq that you can pass as the first
&gt; &gt; &gt; argument.
&gt; &gt; 
&gt; &gt; I actually don&apos;t know. I figured the code was more concise with std::fill
&gt; &gt; and we *might* get more optimized code. I guess I could write a simple
&gt; &gt; benchmark to compare the 2.
&gt; &gt; 
&gt; &gt; Also note that we could very easily add a VectorMath function that uses
&gt; &gt; vDSP_fill() [1] to guarantee we get vectorization. What do you think?
&gt; &gt; 
&gt; &gt; [1]
&gt; &gt; https://developer.apple.com/documentation/accelerate/1450501-
&gt; &gt; vdsp_vfill?language=objc
&gt; 
&gt; I think using accelerate as much as possible in VectorMath is what we should
&gt; be doing. I really see it as a &quot;platform&quot; abstraction around it.
&gt; 
&gt; I still think using std::fill_n here for the non-HAVE(ACCELERATE) case it
&gt; the right way to go. It doesn&apos;t guarantee any vectorization, but since it is
&gt; closer the the compiler, if autovectorization is in the compiler, it is more
&gt; likely the compiler will ensure it works with standard library idioms.

Yes, I think this is a good idea. I will still benchmark std::fill_n() and vDSP_fill() because I am curious now :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698215</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-10-15 11:55:36 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #7)
&gt; (In reply to Sam Weinig from comment #6)
&gt; &gt; (In reply to Chris Dumez from comment #4)
&gt; &gt; &gt; (In reply to Darin Adler from comment #3)
&gt; &gt; &gt; &gt; Comment on attachment 411460 [details]
&gt; &gt; &gt; &gt; Patch
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; View in context:
&gt; &gt; &gt; &gt; https://bugs.webkit.org/attachment.cgi?id=411460&amp;action=review
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; &gt; &gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; Does this get us any vectorization or parallelization? I know that’s the
&gt; &gt; &gt; &gt; long term ambition of the C++ library, they even have
&gt; &gt; &gt; &gt; std::execution::seq/par/par_unseq/unseq that you can pass as the first
&gt; &gt; &gt; &gt; argument.
&gt; &gt; &gt; 
&gt; &gt; &gt; I actually don&apos;t know. I figured the code was more concise with std::fill
&gt; &gt; &gt; and we *might* get more optimized code. I guess I could write a simple
&gt; &gt; &gt; benchmark to compare the 2.
&gt; &gt; &gt; 
&gt; &gt; &gt; Also note that we could very easily add a VectorMath function that uses
&gt; &gt; &gt; vDSP_fill() [1] to guarantee we get vectorization. What do you think?
&gt; &gt; &gt; 
&gt; &gt; &gt; [1]
&gt; &gt; &gt; https://developer.apple.com/documentation/accelerate/1450501-
&gt; &gt; &gt; vdsp_vfill?language=objc
&gt; &gt; 
&gt; &gt; I think using accelerate as much as possible in VectorMath is what we should
&gt; &gt; be doing. I really see it as a &quot;platform&quot; abstraction around it.
&gt; &gt; 
&gt; &gt; I still think using std::fill_n here for the non-HAVE(ACCELERATE) case it
&gt; &gt; the right way to go. It doesn&apos;t guarantee any vectorization, but since it is
&gt; &gt; closer the the compiler, if autovectorization is in the compiler, it is more
&gt; &gt; likely the compiler will ensure it works with standard library idioms.
&gt; 
&gt; Yes, I think this is a good idea. I will still benchmark std::fill_n() and
&gt; vDSP_fill() because I am curious now :)

Interestingly, std::fill_n() seems consistently faster for large arrays than vDSP_fill() on my MacBook Pro:

std::fill_n() took 1.0884ms
vDSP::vfill() took 1.20753ms

Benchmark:

// clang++ -O2 -std=c++14 -framework Accelerate fill_benchmark.cpp -o fill_benchmark
  
#include &lt;algorithm&gt;
#include &lt;chrono&gt;
#include &lt;iostream&gt;
#include &lt;Accelerate/Accelerate.h&gt;

int main()
{
    constexpr unsigned N = 524288;
    const float pi = 3.1415926535;
    float array1[N];
    float array2[N];

    auto start = std::chrono::steady_clock::now();
    std::fill_n(array1, N, pi);
    auto end = std::chrono::steady_clock::now();

    std::chrono::duration&lt;double&gt; diff = end - start;
    std::cout &lt;&lt; &quot;std::fill_n() took &quot; &lt;&lt; diff.count() * 1000 &lt;&lt; &quot;ms\n&quot;;

    start = std::chrono::steady_clock::now();
    vDSP_vfill(&amp;pi, array2, 1, N);
    end = std::chrono::steady_clock::now();

    diff = end - start;
    std::cout &lt;&lt; &quot;vDSP::vfill() took &quot; &lt;&lt; diff.count() * 1000 &lt;&lt; &quot;ms\n&quot;;

    std::cout &lt;&lt; array1[2000] &lt;&lt; &quot; &quot; &lt;&lt; array2[2000] &lt;&lt; &quot;\n&quot;;

    return 0;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698267</commentid>
    <comment_count>9</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2020-10-15 13:59:37 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #8)
&gt; (In reply to Chris Dumez from comment #7)
&gt; &gt; (In reply to Sam Weinig from comment #6)
&gt; &gt; &gt; (In reply to Chris Dumez from comment #4)
&gt; &gt; &gt; &gt; (In reply to Darin Adler from comment #3)
&gt; &gt; &gt; &gt; &gt; Comment on attachment 411460 [details]
&gt; &gt; &gt; &gt; &gt; Patch
&gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; View in context:
&gt; &gt; &gt; &gt; &gt; https://bugs.webkit.org/attachment.cgi?id=411460&amp;action=review
&gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; &gt; &gt; &gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; Does this get us any vectorization or parallelization? I know that’s the
&gt; &gt; &gt; &gt; &gt; long term ambition of the C++ library, they even have
&gt; &gt; &gt; &gt; &gt; std::execution::seq/par/par_unseq/unseq that you can pass as the first
&gt; &gt; &gt; &gt; &gt; argument.
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; I actually don&apos;t know. I figured the code was more concise with std::fill
&gt; &gt; &gt; &gt; and we *might* get more optimized code. I guess I could write a simple
&gt; &gt; &gt; &gt; benchmark to compare the 2.
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; Also note that we could very easily add a VectorMath function that uses
&gt; &gt; &gt; &gt; vDSP_fill() [1] to guarantee we get vectorization. What do you think?
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; [1]
&gt; &gt; &gt; &gt; https://developer.apple.com/documentation/accelerate/1450501-
&gt; &gt; &gt; &gt; vdsp_vfill?language=objc
&gt; &gt; &gt; 
&gt; &gt; &gt; I think using accelerate as much as possible in VectorMath is what we should
&gt; &gt; &gt; be doing. I really see it as a &quot;platform&quot; abstraction around it.
&gt; &gt; &gt; 
&gt; &gt; &gt; I still think using std::fill_n here for the non-HAVE(ACCELERATE) case it
&gt; &gt; &gt; the right way to go. It doesn&apos;t guarantee any vectorization, but since it is
&gt; &gt; &gt; closer the the compiler, if autovectorization is in the compiler, it is more
&gt; &gt; &gt; likely the compiler will ensure it works with standard library idioms.
&gt; &gt; 
&gt; &gt; Yes, I think this is a good idea. I will still benchmark std::fill_n() and
&gt; &gt; vDSP_fill() because I am curious now :)
&gt; 
&gt; Interestingly, std::fill_n() seems consistently faster for large arrays than
&gt; vDSP_fill() on my MacBook Pro:
&gt; 
&gt; std::fill_n() took 1.0884ms
&gt; vDSP::vfill() took 1.20753ms
&gt; 
&gt; Benchmark:
&gt; 
&gt; // clang++ -O2 -std=c++14 -framework Accelerate fill_benchmark.cpp -o
&gt; fill_benchmark
&gt;   
&gt; #include &lt;algorithm&gt;
&gt; #include &lt;chrono&gt;
&gt; #include &lt;iostream&gt;
&gt; #include &lt;Accelerate/Accelerate.h&gt;
&gt; 
&gt; int main()
&gt; {
&gt;     constexpr unsigned N = 524288;
&gt;     const float pi = 3.1415926535;
&gt;     float array1[N];
&gt;     float array2[N];
&gt; 
&gt;     auto start = std::chrono::steady_clock::now();
&gt;     std::fill_n(array1, N, pi);
&gt;     auto end = std::chrono::steady_clock::now();
&gt; 
&gt;     std::chrono::duration&lt;double&gt; diff = end - start;
&gt;     std::cout &lt;&lt; &quot;std::fill_n() took &quot; &lt;&lt; diff.count() * 1000 &lt;&lt; &quot;ms\n&quot;;
&gt; 
&gt;     start = std::chrono::steady_clock::now();
&gt;     vDSP_vfill(&amp;pi, array2, 1, N);
&gt;     end = std::chrono::steady_clock::now();
&gt; 
&gt;     diff = end - start;
&gt;     std::cout &lt;&lt; &quot;vDSP::vfill() took &quot; &lt;&lt; diff.count() * 1000 &lt;&lt; &quot;ms\n&quot;;
&gt; 
&gt;     std::cout &lt;&lt; array1[2000] &lt;&lt; &quot; &quot; &lt;&lt; array2[2000] &lt;&lt; &quot;\n&quot;;
&gt; 
&gt;     return 0;
&gt; }

Interesting. Probably worth a radar to the Accelerate folks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698275</commentid>
    <comment_count>10</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-10-15 14:12:47 -0700</bug_when>
    <thetext>(In reply to Sam Weinig from comment #9)
&gt; (In reply to Chris Dumez from comment #8)
&gt; &gt; (In reply to Chris Dumez from comment #7)
&gt; &gt; &gt; (In reply to Sam Weinig from comment #6)
&gt; &gt; &gt; &gt; (In reply to Chris Dumez from comment #4)
&gt; &gt; &gt; &gt; &gt; (In reply to Darin Adler from comment #3)
&gt; &gt; &gt; &gt; &gt; &gt; Comment on attachment 411460 [details]
&gt; &gt; &gt; &gt; &gt; &gt; Patch
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; &gt; View in context:
&gt; &gt; &gt; &gt; &gt; &gt; https://bugs.webkit.org/attachment.cgi?id=411460&amp;action=review
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; &gt; &gt; &gt; &gt; +        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
&gt; &gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; &gt; Does this get us any vectorization or parallelization? I know that’s the
&gt; &gt; &gt; &gt; &gt; &gt; long term ambition of the C++ library, they even have
&gt; &gt; &gt; &gt; &gt; &gt; std::execution::seq/par/par_unseq/unseq that you can pass as the first
&gt; &gt; &gt; &gt; &gt; &gt; argument.
&gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; I actually don&apos;t know. I figured the code was more concise with std::fill
&gt; &gt; &gt; &gt; &gt; and we *might* get more optimized code. I guess I could write a simple
&gt; &gt; &gt; &gt; &gt; benchmark to compare the 2.
&gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; Also note that we could very easily add a VectorMath function that uses
&gt; &gt; &gt; &gt; &gt; vDSP_fill() [1] to guarantee we get vectorization. What do you think?
&gt; &gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; [1]
&gt; &gt; &gt; &gt; &gt; https://developer.apple.com/documentation/accelerate/1450501-
&gt; &gt; &gt; &gt; &gt; vdsp_vfill?language=objc
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; I think using accelerate as much as possible in VectorMath is what we should
&gt; &gt; &gt; &gt; be doing. I really see it as a &quot;platform&quot; abstraction around it.
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; I still think using std::fill_n here for the non-HAVE(ACCELERATE) case it
&gt; &gt; &gt; &gt; the right way to go. It doesn&apos;t guarantee any vectorization, but since it is
&gt; &gt; &gt; &gt; closer the the compiler, if autovectorization is in the compiler, it is more
&gt; &gt; &gt; &gt; likely the compiler will ensure it works with standard library idioms.
&gt; &gt; &gt; 
&gt; &gt; &gt; Yes, I think this is a good idea. I will still benchmark std::fill_n() and
&gt; &gt; &gt; vDSP_fill() because I am curious now :)
&gt; &gt; 
&gt; &gt; Interestingly, std::fill_n() seems consistently faster for large arrays than
&gt; &gt; vDSP_fill() on my MacBook Pro:
&gt; &gt; 
&gt; &gt; std::fill_n() took 1.0884ms
&gt; &gt; vDSP::vfill() took 1.20753ms
&gt; &gt; 
&gt; &gt; Benchmark:
&gt; &gt; 
&gt; &gt; // clang++ -O2 -std=c++14 -framework Accelerate fill_benchmark.cpp -o
&gt; &gt; fill_benchmark
&gt; &gt;   
&gt; &gt; #include &lt;algorithm&gt;
&gt; &gt; #include &lt;chrono&gt;
&gt; &gt; #include &lt;iostream&gt;
&gt; &gt; #include &lt;Accelerate/Accelerate.h&gt;
&gt; &gt; 
&gt; &gt; int main()
&gt; &gt; {
&gt; &gt;     constexpr unsigned N = 524288;
&gt; &gt;     const float pi = 3.1415926535;
&gt; &gt;     float array1[N];
&gt; &gt;     float array2[N];
&gt; &gt; 
&gt; &gt;     auto start = std::chrono::steady_clock::now();
&gt; &gt;     std::fill_n(array1, N, pi);
&gt; &gt;     auto end = std::chrono::steady_clock::now();
&gt; &gt; 
&gt; &gt;     std::chrono::duration&lt;double&gt; diff = end - start;
&gt; &gt;     std::cout &lt;&lt; &quot;std::fill_n() took &quot; &lt;&lt; diff.count() * 1000 &lt;&lt; &quot;ms\n&quot;;
&gt; &gt; 
&gt; &gt;     start = std::chrono::steady_clock::now();
&gt; &gt;     vDSP_vfill(&amp;pi, array2, 1, N);
&gt; &gt;     end = std::chrono::steady_clock::now();
&gt; &gt; 
&gt; &gt;     diff = end - start;
&gt; &gt;     std::cout &lt;&lt; &quot;vDSP::vfill() took &quot; &lt;&lt; diff.count() * 1000 &lt;&lt; &quot;ms\n&quot;;
&gt; &gt; 
&gt; &gt;     std::cout &lt;&lt; array1[2000] &lt;&lt; &quot; &quot; &lt;&lt; array2[2000] &lt;&lt; &quot;\n&quot;;
&gt; &gt; 
&gt; &gt;     return 0;
&gt; &gt; }
&gt; 
&gt; Interesting. Probably worth a radar to the Accelerate folks.

Ok, rdar://problem/70351530.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698277</commentid>
    <comment_count>11</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-10-15 14:15:23 -0700</bug_when>
    <thetext>Committed r268553: &lt;https://trac.webkit.org/changeset/268553&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 411460.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1698278</commentid>
    <comment_count>12</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-10-15 14:16:20 -0700</bug_when>
    <thetext>&lt;rdar://problem/70351684&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>411460</attachid>
            <date>2020-10-15 10:44:53 -0700</date>
            <delta_ts>2020-10-15 14:15:24 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-217766-20201015104452.patch</filename>
            <type>text/plain</type>
            <size>2113</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjY4NTI2CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNmEyMWQ5OWViZGExZWQ2
MDg1NzJhZGFiZjJhNWI4MjEzM2EzYmU5NS4uZTllNDRlMzgzYzc2NTU1YzY0NDA4NDkyZWY3ZWRi
NGMzNjRjNTY3MCAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE3IEBACisyMDIwLTEwLTE1ICBDaHJp
cyBEdW1leiAgPGNkdW1lekBhcHBsZS5jb20+CisKKyAgICAgICAgVXNlIHN0ZDo6ZmlsbF9uKCkg
aW5zdGVhZCBvZiBmb3IgbG9vcHMgaW4gQXVkaW9QYXJhbTo6Y2FsY3VsYXRlRmluYWxWYWx1ZXMo
KQorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MjE3NzY2
CisKKyAgIC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