title: Performance of Rasberry Pi 3 compared to Intel Core i7 (floating point operations)
body: <p>I did a simple performance comparison focused on <strong>floating point operations</strong> using C#, targeted for <strong>Raspberry Pi 3 Model 2</strong> with <strong>Windows 10 IoT</strong> and I have compare it to <strong>Intel Core i7-6500U CPU @ 2.50GHz</strong>.</p>
  
  <p><a href="https://i.stack.imgur.com/PeJPV.png" rel="nofollow noreferrer">Raspberry Pi 3 Model B V1.2 - Test Results - Chart</a></p>
  
  <p><a href="https://i.stack.imgur.com/xMkrx.png" rel="nofollow noreferrer">Intel Core i7-6500U CPU @ 2.50GHz - x64 Test Results - Chart</a></p>
  
  <p>Intel Core i7 is <strong>only twelve times faster</strong> (x64) than Raspberry Pi 3! - according to those tests.</p>
  
  <p>The factor is <strong>11.67</strong> to be exact and was calculated for best performance achieved within those tests on each platform. Both platforms achieved best performance for four threads run in parallel making computations (very simple, independent calculations).</p>
  
  <p><strong>Question:</strong> what is the correct method to measure and compare computational performance such platforms? The intention is to compare computational performance in the area of optimization algorithms, machine learning algorithms, statistical analysis, etc. Thus my focus was on floating point operations.</p>
  
  <p>There are some benchmarks (like MWIPS) and measures like MIPS or FLOPS. But I didn't found one way to compare different CPU platforms in terms of computational power.</p>
  
  <p>I found one comparison by Roy Longbottom's (Google "Roy Longbottom's Raspberry Pi, Pi 2 and Pi 3 Benchmarks" - I can not post more links here) but according to his benchmark Raspberry Pi 3 is only <strong>four times</strong> faster than Intel Core i7 (x64 architecture, MFLOPS comparison). So very different than my results.</p>
  
  <p>Here are details of the tests that I performed:</p>
  
  <p>The test was build around simple operation supposed to be executed iteratively:</p>
  
  <pre><code>    private static float SingleAverageCalc(float seed, long nTimes)
      {
          float x1 = seed, x2 = 0;
          long n = 0;
  
          for (; n &lt; nTimes; ++n)
          {
              x2 = x2 + x1 * n;
          }
  
          return x2 / n;
      }
  </code></pre>
  
  <p>where <strong>seed</strong> is generated randomly in the calling function and <strong>nTimes</strong> is the number of iterations. Intention is to avoid simple compile-time optimisations.</p>
  
  <p>This test function has been called several times with various iteration number (1M, 10M, 100M and 1B) in single thread and for multiple threads. Multithreaded test look as below:</p>
  
  <pre><code>    private static async void RunTestMT(string name, long n, int tn, Func&lt;float, long, float&gt; f)
      {
          float seed = (float)new Random().NextDouble();
          DateTime s1 = DateTime.Now;
          List&lt;IAsyncAction&gt; threads = new List&lt;IAsyncAction&gt;();
          for (int i = 0; i &lt; tn; i++)
          {
              threads.Add( ThreadPool.RunAsync((operation) =&gt; { f(seed, n/tn); }, WorkItemPriority.High));
          }
          for (int i = 0; i &lt; tn; i++)
          {
              threads[i].AsTask().Wait();
          }
          TimeSpan dt = DateTime.Now - s1;
  
          Debug.WriteLine(String.Format("{0} ({1:N0}; {3}T): {2:mm\\:ss\\.fff}", name, n, dt, tn));
      }
  </code></pre>
  
  <p>Test have been run in <strong>Debug</strong> mode. Application was built as UWP (Universal Windows Platform). ARM architecture for Raspberry Pi and x86 for Intel.</p>