Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. .Net 8 Poor performance on AMD cpu

.Net 8 Poor performance on AMD cpu

Scheduled Pinned Locked Moved The Lounge
csharpvisual-studioperformancehelpquestion
8 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Behzad Sedighzadeh
    wrote on last edited by
    #1

    On paper AMD Ryzen 5900x has twice horsepower than Intel i5-12400, though in single thread applications, 12400 is lightly better. So we checked this fact by a very simple winform application ( Net 8 - VS 2022 ver. 17.8.4 ):

    List lv = new List();
    listView1.Items.Clear();

    for (int i = 0; i < numericUpDown1.Value; i++)
    {
    ListViewItem item = new ListViewItem(i.ToString("D8"));
    TestClass t = new TestClass(i);
    item.Tag = t;
    item.SubItems.Add(t.ID.ToString("D8"));
    item.SubItems.Add(t.ID2.ToString("D8"));
    item.SubItems.Add(t.ID3.ToString("D8"));
    item.SubItems.Add(t.ID4.ToString("D8"));
    lv.Add(item);
    }

    listView1.BeginUpdate();
    listView1.Items.AddRange(lv.ToArray());
    listView1.EndUpdate();

    With

    numericUpDown1.Value= 1_000_000

    10 times benchmark, Intel cpu completed the task on average in 18 seconds. AMD cpu never completed the task below 60 seconds. Intel cpu setup: Win11 in VirtualBox with 6 cores 16 GB RAM ADATA NVME 2.0 disk AMD cpu setup: bare metal Win11 48 GB RAM SAMSUNG NVME 2.0 disk. What's wrong with AMD cpu? Who should we blame on issue: MS or AMD? Any idea? P.S.: I'm a hardcore fan of AMD.

    Behzad

    Mike HankeyM H Graeme_GrantG L J 5 Replies Last reply
    0
    • B Behzad Sedighzadeh

      On paper AMD Ryzen 5900x has twice horsepower than Intel i5-12400, though in single thread applications, 12400 is lightly better. So we checked this fact by a very simple winform application ( Net 8 - VS 2022 ver. 17.8.4 ):

      List lv = new List();
      listView1.Items.Clear();

      for (int i = 0; i < numericUpDown1.Value; i++)
      {
      ListViewItem item = new ListViewItem(i.ToString("D8"));
      TestClass t = new TestClass(i);
      item.Tag = t;
      item.SubItems.Add(t.ID.ToString("D8"));
      item.SubItems.Add(t.ID2.ToString("D8"));
      item.SubItems.Add(t.ID3.ToString("D8"));
      item.SubItems.Add(t.ID4.ToString("D8"));
      lv.Add(item);
      }

      listView1.BeginUpdate();
      listView1.Items.AddRange(lv.ToArray());
      listView1.EndUpdate();

      With

      numericUpDown1.Value= 1_000_000

      10 times benchmark, Intel cpu completed the task on average in 18 seconds. AMD cpu never completed the task below 60 seconds. Intel cpu setup: Win11 in VirtualBox with 6 cores 16 GB RAM ADATA NVME 2.0 disk AMD cpu setup: bare metal Win11 48 GB RAM SAMSUNG NVME 2.0 disk. What's wrong with AMD cpu? Who should we blame on issue: MS or AMD? Any idea? P.S.: I'm a hardcore fan of AMD.

      Behzad

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #2

      Blame it on the Bossa Nova[^] Sorry it's Saturday and I'm bored. I'll get my coat

      "Ten men in the country could buy the world and ten million can’t buy enough to eat." Will Rogers PartsBin an Electronics Part Organizer - Release Version 1.3.1 JaxCoder.com Latest Article: EventAggregator

      1 Reply Last reply
      0
      • B Behzad Sedighzadeh

        On paper AMD Ryzen 5900x has twice horsepower than Intel i5-12400, though in single thread applications, 12400 is lightly better. So we checked this fact by a very simple winform application ( Net 8 - VS 2022 ver. 17.8.4 ):

        List lv = new List();
        listView1.Items.Clear();

        for (int i = 0; i < numericUpDown1.Value; i++)
        {
        ListViewItem item = new ListViewItem(i.ToString("D8"));
        TestClass t = new TestClass(i);
        item.Tag = t;
        item.SubItems.Add(t.ID.ToString("D8"));
        item.SubItems.Add(t.ID2.ToString("D8"));
        item.SubItems.Add(t.ID3.ToString("D8"));
        item.SubItems.Add(t.ID4.ToString("D8"));
        lv.Add(item);
        }

        listView1.BeginUpdate();
        listView1.Items.AddRange(lv.ToArray());
        listView1.EndUpdate();

        With

        numericUpDown1.Value= 1_000_000

        10 times benchmark, Intel cpu completed the task on average in 18 seconds. AMD cpu never completed the task below 60 seconds. Intel cpu setup: Win11 in VirtualBox with 6 cores 16 GB RAM ADATA NVME 2.0 disk AMD cpu setup: bare metal Win11 48 GB RAM SAMSUNG NVME 2.0 disk. What's wrong with AMD cpu? Who should we blame on issue: MS or AMD? Any idea? P.S.: I'm a hardcore fan of AMD.

        Behzad

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #3

        It could be a number of things, but the first thing I'd look at is the generated native code and see how it compares for the different architectures. That could make a mountain of difference. The other things are more difficult to track down, especially with managed code - is your code remaining in the CPU's cache line as its executing? There's also the other question, and that is Winforms, which relies heavily on the windows subsystem and unmanaged code. If I were you, I'd fashion a barebones .NET 6+ console application that benches N iterations, 5 times overall where N is some arbitrarily large number based roughly on how long it takes to perform each iteration. Then run that on both and check your results.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        1 Reply Last reply
        0
        • B Behzad Sedighzadeh

          On paper AMD Ryzen 5900x has twice horsepower than Intel i5-12400, though in single thread applications, 12400 is lightly better. So we checked this fact by a very simple winform application ( Net 8 - VS 2022 ver. 17.8.4 ):

          List lv = new List();
          listView1.Items.Clear();

          for (int i = 0; i < numericUpDown1.Value; i++)
          {
          ListViewItem item = new ListViewItem(i.ToString("D8"));
          TestClass t = new TestClass(i);
          item.Tag = t;
          item.SubItems.Add(t.ID.ToString("D8"));
          item.SubItems.Add(t.ID2.ToString("D8"));
          item.SubItems.Add(t.ID3.ToString("D8"));
          item.SubItems.Add(t.ID4.ToString("D8"));
          lv.Add(item);
          }

          listView1.BeginUpdate();
          listView1.Items.AddRange(lv.ToArray());
          listView1.EndUpdate();

          With

          numericUpDown1.Value= 1_000_000

          10 times benchmark, Intel cpu completed the task on average in 18 seconds. AMD cpu never completed the task below 60 seconds. Intel cpu setup: Win11 in VirtualBox with 6 cores 16 GB RAM ADATA NVME 2.0 disk AMD cpu setup: bare metal Win11 48 GB RAM SAMSUNG NVME 2.0 disk. What's wrong with AMD cpu? Who should we blame on issue: MS or AMD? Any idea? P.S.: I'm a hardcore fan of AMD.

          Behzad

          Graeme_GrantG Offline
          Graeme_GrantG Offline
          Graeme_Grant
          wrote on last edited by
          #4

          There is something more to the issue that is not apparent from the information provided. As Honey pointed out, there are many other factors to consider. As for the code itself, it baffles me why you want to load 1M rows into a ListView control like that. You're much better off finding ways to reduce the number of rows loaded. However, if you need to do this, there are better ways like virtualization. Read this (with code sample): ListView.VirtualMode Property (System.Windows.Forms) | Microsoft Learn[^]. If you make this change, the app will run much more efficiently on both machines. ;P

          Graeme


          "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

          “I fear not the man who has practised 10,000 kicks once, but I fear the man who has practised one kick 10,000 times.” - Bruce Lee.

          J 1 Reply Last reply
          0
          • Graeme_GrantG Graeme_Grant

            There is something more to the issue that is not apparent from the information provided. As Honey pointed out, there are many other factors to consider. As for the code itself, it baffles me why you want to load 1M rows into a ListView control like that. You're much better off finding ways to reduce the number of rows loaded. However, if you need to do this, there are better ways like virtualization. Read this (with code sample): ListView.VirtualMode Property (System.Windows.Forms) | Microsoft Learn[^]. If you make this change, the app will run much more efficiently on both machines. ;P

            Graeme


            "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

            J Offline
            J Offline
            jmaida
            wrote on last edited by
            #5

            i agree with honey and graeme run bench that focuses on hardware performance I use dhrystone /* * "DHRYSTONE" Benchmark Program * * Version: C/1 * Date: 12/01/84 * Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013 * Translated from ADA by Rick Richardson

            "A little time, a little trouble, your better day" Badfinger

            1 Reply Last reply
            0
            • B Behzad Sedighzadeh

              On paper AMD Ryzen 5900x has twice horsepower than Intel i5-12400, though in single thread applications, 12400 is lightly better. So we checked this fact by a very simple winform application ( Net 8 - VS 2022 ver. 17.8.4 ):

              List lv = new List();
              listView1.Items.Clear();

              for (int i = 0; i < numericUpDown1.Value; i++)
              {
              ListViewItem item = new ListViewItem(i.ToString("D8"));
              TestClass t = new TestClass(i);
              item.Tag = t;
              item.SubItems.Add(t.ID.ToString("D8"));
              item.SubItems.Add(t.ID2.ToString("D8"));
              item.SubItems.Add(t.ID3.ToString("D8"));
              item.SubItems.Add(t.ID4.ToString("D8"));
              lv.Add(item);
              }

              listView1.BeginUpdate();
              listView1.Items.AddRange(lv.ToArray());
              listView1.EndUpdate();

              With

              numericUpDown1.Value= 1_000_000

              10 times benchmark, Intel cpu completed the task on average in 18 seconds. AMD cpu never completed the task below 60 seconds. Intel cpu setup: Win11 in VirtualBox with 6 cores 16 GB RAM ADATA NVME 2.0 disk AMD cpu setup: bare metal Win11 48 GB RAM SAMSUNG NVME 2.0 disk. What's wrong with AMD cpu? Who should we blame on issue: MS or AMD? Any idea? P.S.: I'm a hardcore fan of AMD.

              Behzad

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              It's not a practical application. It should get the attention it deserves. My first thought was keyboard buffers, repetition counts and reentrancy. But there is no keyboard.

              "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

              J 1 Reply Last reply
              0
              • L Lost User

                It's not a practical application. It should get the attention it deserves. My first thought was keyboard buffers, repetition counts and reentrancy. But there is no keyboard.

                "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

                J Offline
                J Offline
                jmaida
                wrote on last edited by
                #7

                I agree. Dhrystone mainly tests integer and character operations, the most common operations. but it's a clean start.

                "A little time, a little trouble, your better day" Badfinger

                1 Reply Last reply
                0
                • B Behzad Sedighzadeh

                  On paper AMD Ryzen 5900x has twice horsepower than Intel i5-12400, though in single thread applications, 12400 is lightly better. So we checked this fact by a very simple winform application ( Net 8 - VS 2022 ver. 17.8.4 ):

                  List lv = new List();
                  listView1.Items.Clear();

                  for (int i = 0; i < numericUpDown1.Value; i++)
                  {
                  ListViewItem item = new ListViewItem(i.ToString("D8"));
                  TestClass t = new TestClass(i);
                  item.Tag = t;
                  item.SubItems.Add(t.ID.ToString("D8"));
                  item.SubItems.Add(t.ID2.ToString("D8"));
                  item.SubItems.Add(t.ID3.ToString("D8"));
                  item.SubItems.Add(t.ID4.ToString("D8"));
                  lv.Add(item);
                  }

                  listView1.BeginUpdate();
                  listView1.Items.AddRange(lv.ToArray());
                  listView1.EndUpdate();

                  With

                  numericUpDown1.Value= 1_000_000

                  10 times benchmark, Intel cpu completed the task on average in 18 seconds. AMD cpu never completed the task below 60 seconds. Intel cpu setup: Win11 in VirtualBox with 6 cores 16 GB RAM ADATA NVME 2.0 disk AMD cpu setup: bare metal Win11 48 GB RAM SAMSUNG NVME 2.0 disk. What's wrong with AMD cpu? Who should we blame on issue: MS or AMD? Any idea? P.S.: I'm a hardcore fan of AMD.

                  Behzad

                  J Offline
                  J Offline
                  jochance
                  wrote on last edited by
                  #8

                  Configure projects to target platforms - Visual Studio (Windows) | Microsoft Learn[^] An interesting/easy thing to try is building specifically for x86 and x64, testing both. It's a bit weird this isn't inverted. (x64 = AMD instruction sets, afaik - even on Intel chips) Aside that, I think strings being a bit of a special animal is likely playing into this heavily. Also, setting a .Tag to an object (instead of a string) is "weird" but that weirdness may be a figment of my imagination and that may be a perfectly normal thing to do.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups