Dev Center > Windows Forms Forums > Windows Forms General > Performance of a .net 3.5 Sp1 Winform application on Windows 7

Unanswered Performance of a .net 3.5 Sp1 Winform application on Windows 7

  • Monday, February 15, 2010 5:49 AM
     
     
    Hello,

    I recently purchased a high performance, Windows 7, 64 bit based PC for improving the performance of my intensive .net application

    trouble is my old laptop running XP with 1/2 gig of memory is outperforming it in both video refresh rates and number crunching

    The disk performance on my new machine is far better though

    The video refresh issue I think I have solved and it relates to the new nVidia card drivers not rendering the lines on a DataGridView during scrolling very well.

    I have added the option to hide/unhide the lines in the cells and the performance picks up a lot

    Now, when I load and process the large amount of data, the laptop dedicates a significant amount of CPU time to the number crunching, whereas my "Tower of Power" is mostly idle.

    I have no doubt if I rewrote the app to crunch all this data on multiple threads I would get the performance boost

    Is there anyway to avoid that?  can I get my machine to dedicate more of its idle CPU time to getting this job done quicker?

    TIA

All Replies

  • Monday, February 15, 2010 8:08 AM
    Moderator
     
     
    Hi michaelmfranz,

    When the data is large, I would encourage you to use VirtualMode function of DataGridView. The following document well explains it. You can also learn from the sample code in the document.
    http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.virtualmode.aspx

    Hope it helps. If you have anything unclear, please feel free to tell me.

    Sincerely,
    Kira Qian
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
  • Thursday, February 18, 2010 8:16 AM
    Moderator
     
     
    Hi michaelmfranz,

    I am writing to check the status of the issue on your side. Could you please let me know if the suggestion works for you? If you have any questions or concerns, please feel free to let me know. I will be more than happy to be of assistance.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
  • Thursday, February 18, 2010 9:53 AM
     
     
    Hello Kira,

    thanks for your help, this issue is two parts - 

    1. datagridview slow line rendering 
    2. Windows 7 sitting idle when it has plenty of CPU to burn

    a different video card/chip solves issue 1, coding is not the solution in my opinion 
    multithreading will solve issue 2.  I have done it elsewhere in my software and it helps a lot


    I am getting a new video card tomorrow, in the meantime I would hope that someone from microsoft investigates this DataGridView rendering issue properly and informs nVidia, its been around awhile





  • Thursday, February 18, 2010 3:51 PM
     
     
    when you say that the system is sitting idle, are you determining that by looking at the performance graph(s) in task manager?  Do you have/see multiple cores and are you viewing one graph for all cores or one per core?
    jon.stromer.galley
  • Thursday, February 18, 2010 9:21 PM
     
     
    yes I am viewing in task manager

    On my XP laptop which shows one chart/core it gets up to 70% utilization and the processing is faster as it iterates through the collection and does its processing on about 2000 records

    the 64 bit windows 7 machine shows eight cores and an average utilization that peaks around 4% but it does the same job in about 50% more time

    very frustrating, I tried to elevate the thread priority as a simple fix but this did nothing

    so my solution will be to split the collection up, do the processing and merge it at the end

    this should show a huge improvement in performance

    another option is .net 4, but as far as I can tell this only works under VStudio 2010,

    I loaded .net 4.0 and it did not come up as a target platform option in visual studio 2008
  • Friday, February 19, 2010 2:08 AM
    Moderator
     
     
    Hi michaelmfranz,

    Do you mean it costs a lot of time querying data from database? VirtualMode doesn’t help in querying data. It helps in UI level. For example, you have 1,000,000 rows to fetch which costs you 90 seconds. After getting the data, you use it to bind to DataGridView. DataGridView need at least 60 seconds to load all data. But when you use VirtualMode, DataGridView costs less time to load data. It only loads the necessary rows when you scrolling. That mean you the querying data time cannot be reduced. You still need to wait 90 seconds to query data.

    Does the data store on server? If so, during the time you are querying data, the work is done by the server. You server’s CPU usage increases highly at that time. It doesn’t cost your client CPU usage. When you use multi-thread to do the work, it really increases the CPU usage. So if the database is on your client PC, multi-thread can improve the performance by taking more CPU usage.

    PS: 8 core CPU. Wow, that’s a great PC!

    Sincerely,
    Kira Qian
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
  • Friday, February 19, 2010 5:53 AM
     
     
    no Kira,

    no database involved.  

    I load a file with ~2000 rows,

    processed the data with many calculations 

    bind the 2000 rows to a grid.


    I have a new video card and the lines are rendering well

    there is some things I could do to improve performance other than multi-threading
    to save developer time I haven't used LinQ queries and I search through collections extensively during processing

  • Monday, February 22, 2010 1:56 AM
    Moderator
     
     
    michaelmfranz,

    I don’t think there is any way to improve the performance without multithreading. Your current design is for single core CPU. When you come to multi-core CPU, it doesn’t take full use of it.

    > processed the data with many calculations

    It is not clear to me your business logic. Here is a thread talking about process one object with multithread.
    http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/5e523bb9-e252-4225-84ea-0ea99114dc09
    Hope you can get some idea from it.

    > I have a new video card and the lines are rendering well

    I still cannot understand why it relates to your video card. Winform use GDI+ to render to UI. Even WPF which takes advantage of DirectX still works fine on a mother board integrated graphic card.

    Sincerely,
    Kira Qian
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
  • Thursday, February 25, 2010 6:33 AM
    Moderator
     
     
    Hi michaelmfranz,

    How about the issue now? Did you take the multiple thread option?
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
  • Wednesday, March 03, 2010 10:28 AM
     
     
    Actually no,

    I didnt need to

    turns out that doing a form.refresh in a loop was the issue

    seems that under windows 7, 64 bit this is quite slow.  

    I found this out using ants profiler from red gate

    I will use a progress bar to show load progress in future

    performance is really good now