none
Debugger is taking an Enormous amount of time. RRS feed

  • Question

  • I have been building an application for about a month now in my spare time and the debugger has been slow but not so much that it is completely unusable in a practical sense.  I recently added an important part of its functionality and now it takes 5-10 minutes for the application to finish loading.  It is running a background worker that scans a large number of binary files (more than 1000) using a BinaryReader for specific items (but mainly just counting records the files contain) and then finally gets to a point where most of the functionality is finally usable.  I cannot spend 10 minutes loading the application every time I want to debug code beyond the scanning portion.  When I run the software normally, it takes about 2 seconds to do what is currently taking 5-10 minutes while debugging.

    Why is this happening and what can I do to significantly speed things up?  I can share code but the sections that handle the reading of the files are quite involved so I would need an idea of what people need to see (if anything).

    FYI I am using VS 2019 Community Edition


    • Edited by primem0ver Sunday, May 31, 2020 10:21 PM
    Sunday, May 31, 2020 10:12 PM

All replies

  • Hi primem0ver,

    Compared to running the application directly, debugging requires additional modules to be loaded to allow you to supervise the operation of the program.

    You can try to disable "Suppress JIT optimizations on module load" in Debug -> Options -> General, which can avoid optimizing the code in your binaries.

    And go to Tools -> Options -> IntelleTrace, and then disable the intellitrace event you don't need.

    BTW, please refer more about improving performance here: https://devblogs.microsoft.com/devops/make-debugging-faster-with-visual-studio/

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, June 1, 2020 2:17 AM
  • There has been a delay in my response because I was adding a new capability to my project which required a significant amount of time.  I am nearly finished that addition so I came back to try your suggestions.  Suggestion 1 didn't improve anything  and I don't have any "Intellitrace" options in my settings.  I am looking at the article you linked and will see what I can find there and get back to this if anything helps.  Thanks for trying.
    Saturday, June 6, 2020 12:07 AM
  • Nothing in that article really goes beyond what you have already said.  To give an idea of what is going on, here the section of code that is taking an enormous amount of time (just the surface since the analysis is complicated):

    private void FinishPendingReaders(object sender, DoWorkEventArgs e)
    {
    	bool updatedui = false;
    	int progress = 0;
    	Globals.BackgroundLoader.ReportProgress(0);
    	Mod mod;
    	BindingList<Mod> mods = Globals.DefaultCategory.BaseModList;
    	for (int i = 0; i < mods.Count; ++i)
    	{
    		mod = mods[i];
    		if (mod.PendingReader != null)
    		{
    			++progress;
    			mod.DoPendingRead();
    			rowUpdateQueue.Enqueue(mod);
    			Globals.ReportArgs.Update(progress);
    			Globals.BackgroundLoader.ReportProgress(1);
    		}
    	}
    	Globals.BackgroundLoader.ReportProgress(100);
    }
    "Mods" are the files being scanned to count how many modification records they contain and to see if they contain a specific type of record.  There are over 1200 files being scanned.  Please note that my times in the original post were approximated after some finagling.  However they appear to have been wrong (or following the suggestions here only made things worse).  I have never waited for the software to complete as I just can't take the time.  To test the performance I disabled the background worker and put the above method in the main thread to see if that made a difference.  After a minute I paused the program just to see where I was at.  It was only in the TWELFTH (12) file.  That means it is doing only one file every five seconds.  At that rate it would take over an hour and a half to complete the scan.  It normally takes about 2 seconds to do all 1200.  Something is SERIOUSLY wrong here.


    • Edited by primem0ver Saturday, June 6, 2020 1:49 AM
    Saturday, June 6, 2020 12:58 AM
  • Here is the REAL EYE OPENER letting me know that something really is SERIOUSLY WRONG with the Visual Studio 2019 debugger.  I ran the debugger in VS 2017 on the same code.   It took only 10 seconds to complete the same section of code.  Guess I am going back to VS 2017 until Microsoft gets this fixed.  I should probably report this issue. 



    • Edited by primem0ver Saturday, June 6, 2020 1:51 AM
    Saturday, June 6, 2020 1:12 AM
  • Hi primer0ver,

    Sorry for delay in reply.

    Have you reported this issue to developer community? If yes, we suggest you could share the link here, and other community members who interested in it will help you vote it. If no, we could help you report it.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, June 10, 2020 8:54 AM