title: .NET Core slow on LINUX and fast on MAC/WINDOWS
body: <p>I created a simple asp.net core webapi application using .net core 2.0 preview 2. 
  It is almost the generated sample project generated by the dotnet wepapi command. All this simple applications does is to return a list of 1.000.000 instances. Those 1 million instances are fix and only generated once.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc;
  
  namespace print.Controllers
  {
      [Route("api/[controller]")]
      public class PrintController : Controller
      {
          private PrintOutList list = null;
  
          // GET api/values
          [HttpGet]
          public IActionResult Get()
          {
              if (list == null)
              {
                  list = new PrintOutList();
                  list.Build(1000000);
              }
              return new OkObjectResult(list);
          }            
      }
  
      public enum Weekday
      {
          Monday = 1,
          Tuesday = 2,
          Wednesday = 3
      }
  
      public class PrintOut
      {
          public string Id { get; set; }
          public int ActorObjectTypeId { get;set;}
          public string ActorId { get; set;}
          public int PrintObjectTypeId { get ; set ;}
          public string PrintObjectId { get; set;}
          public string Text { get; set;}
          public Weekday Weekday { get; set; }
      }
  
      public class PrintOutList : List&lt;PrintOut&gt;
      {
          public void Build(int  count)
          {
              for(int index=0;index&lt;count;index++)
              {
                  PrintOut element = new PrintOut();
  
                  if (index == 0) element.Id = "4711";
                  else element.Id = Guid.NewGuid().ToString();
                  element.ActorObjectTypeId = 100;
                  element.ActorId = Guid.NewGuid().ToString();
                  element.PrintObjectTypeId = 200;
                  element.PrintObjectId = Guid.NewGuid().ToString();
                  element.Text = "This is just a sample. " + index.ToString();
                  element.Weekday = Weekday.Monday;
                  Add(element);
              }
  
          }
      }
  }
  </code></pre>
  
  <p><strong>Windows 7: 3,8 seconds (Native Machine) - GOOD</strong>: 
  Results on Windows 7 using "2.0.0-preview2-006497"
  This machine is using 8 GB RAM, 8 Cores, NOT Virtualized
  Staring the server: dotnet bin/release/netcoreapp2.0/publish/print.dll</p>
  
  <pre><code>$ curl -w "@curl-format.txt" -s http://10.40.10.23:5000/api/print -o /dev/null
            remote_ip:  10.40.10.23
             local_ip:  10.40.10.23
          num_connect:  1
        num_redirects:  0
      time_namelookup:  0,000000 Seconds
         time_connect:  0,000000 Seconds
      time_appconnect:  0,000000 Seconds
     time_pretransfer:  0,000000 Seconds
        time_redirect:  0,000000 Seconds
   time_starttransfer:  1,232000 Seconds
        size_download:  294888859 Bytes
          size_header:  148 Bytes
         size_request:  89 Bytes
       speed_download:  77479994,000 Bytes/s
  ----------------------------------------------
           time_total:  3,806000
  </code></pre>
  
  <p><strong>RHEL 7.2: 24,78 seconds (Virtual Machine VMWare Workstation) - BAD</strong>: 
  Results on RHEL 7.2 using "2.0.0-preview2-006497"
  This machine is runing within VMWARE Workstation using 2 GB RAM, 2 Cores
  Staring the server: [root@node0 print]# /opt/dotnet/dotnet ./bin/release/netcoreapp2.0/publish/print.dll</p>
  
  <pre><code>[root@node0 ~]# curl -w "@curl-format.txt" -s http://10.40.10.59:5000/api/print -o /dev/null
            *remote_ip:  10.40.10.59
             local_ip:  10.40.10.59
          num_connect:  1
        num_redirects:  0
      time_namelookup:  0.000 Seconds
         time_connect:  0.001 Seconds
      time_appconnect:  0.000 Seconds
     time_pretransfer:  0.001 Seconds
        time_redirect:  0.000 Seconds
   time_starttransfer:  21.286 Seconds
        size_download:  294888859 Bytes
          size_header:  148 Bytes
         size_request:  89 Bytes
       speed_download:  11937938.000 Bytes/s
  ----------------------------------------------
           time_total:  24.702*
  </code></pre>
  
  <p><strong>RHEL 7.4: 21,6 seconds (Virtual Machine ESX Server) - BAD</strong>: 
  Results on RHEL 7.4 using "2.0.0-preview2-006497"
  This machine is runing within VMWARE Workstation using 4 GB RAM, 2 Cores
  Staring the server: [root@node0 print]# /opt/dotnet/dotnet ./bin/release/netcoreapp2.0/publish/print.dll</p>
  
  <pre><code>[root@node1 ~]# curl -w "@curl-format.txt" -s http://10.40.40.40:5000/api/print -o /dev/null
            remote_ip:  10.40.40.40
             local_ip:  10.40.40.40
          num_connect:  1
        num_redirects:  0
      time_namelookup:  0.000 Seconds
         time_connect:  0.000 Seconds
      time_appconnect:  0.000 Seconds
     time_pretransfer:  0.000 Seconds
        time_redirect:  0.000 Seconds
   time_starttransfer:  18.043 Seconds
        size_download:  294888859 Bytes
          size_header:  148 Bytes
         size_request:  89 Bytes
       speed_download:  13641913.000 Bytes/s
  ----------------------------------------------
           time_total:  21.616
  </code></pre>
  
  <p><strong>OSX: 4,0 seconds (Native Machine) - GOOD</strong> : 
  Results on OSX (current cersion)
  This machine is using 16 GB RAM, 4 Cores
  I just have a screenshot of the results.
  The total time was round about 4 seconds</p>
  
  <p>On a <strong>Fedora 25</strong> linux I also had the bad results of 25 seconds.</p>
  
  <p>My question is about the performance difference using .net core on windows and linux. Is .net core on linux generally slower than on windows? If not, what is a possible explanation for such a big difference?</p>