Author Topic: 20.3 Slow to launch on SSD Laptop  (Read 7648 times)

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
20.3 Slow to launch on SSD Laptop
« on: July 05, 2021, 03:39:46 am »
I have an interesting problem on one Win 10 laptop, for some reason 20.3 has suddenly become very slow to launch.

I've tried a reinstall / clean install, I've removed the default project folders, nothing I do seems to make a difference. It appears to me that the program is very slow at parsing the lexers during launch. I have quite a fast laptop with 1TB SSD, and launch is now taking almost 60 to 80s. On my desktop with a similar processor and a 2TB HDD launch happens in about 10 to 15s. The laptop was previously just as fast if not faster than the desktop, but for some unknown reason it has now slowed. I have not noticed any slow down in other software.

I'm new to Code::Blocks so any suggestions for a first diagnostic step will be greatly appreciated?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2317
Re: 20.3 Slow to launch on SSD Laptop
« Reply #1 on: July 05, 2021, 07:24:22 am »
Your virus checker may be latching on it to check for viruses before allowing it to run. This happened to me.

Try excluding the .exe or CB folder from the virus checker. See if that helps.

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #2 on: July 06, 2021, 09:13:45 am »
Hi Pecan,

Thanks for the response, I've tried excluding the folders from real-time protection and even tried removing the anti-virus, but it's had little if any impact, the problem is truly bizarre.

Offline Commaster

  • Almost regular
  • **
  • Posts: 129
Re: 20.3 Slow to launch on SSD Laptop
« Reply #3 on: July 06, 2021, 10:38:05 am »
In this case I'd keep the "Task Manager" open on the "Details" tab, sorted descending by "CPU".
Additionally, keep the "Resource Monitor" open on the "Disk" tab, "Disk Activity" subgroup, sorted descending by "Total (B/sec)".

Just a wild guess, most likely wrong: RAM is full so you are bullying your SWAP.

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #4 on: July 08, 2021, 03:28:55 am »
Commaster, thanks for the advice.

I launched as advised, certainly CPU goes to 100% and Code::Blocks shows as Not Repsonding. RAM never exceeds 46% of the available 16Gb, it sits at about 43% normally, and the disk is barely loaded. Only multiple instances of gcc showing up momentarily near the top of the list in the disk read column. I see some activity momentarily from anti-virus, etc., but it is just a spike not sustained.

I suppose I can rule out disk acces as the problem, unless the absence of disc activity is the problem.

There are two oddities in CPU usage during Code::Blocks launch as it is parsing the lexers, during that moment you see the program icon flashing on the taskbar. They are MS iType (Mouse and Keyboard Center) and Windows Driver Foundation - User-Mode Driver Foundation Host Process.

Interestingly, I've tried resetting the Code::Blocks Compiler options to defaults, I have the MingGW bundle installed. I see the very same sluggish behaviour on the laptop during the reset process with the CPU also going to 100% during this process. It automatically finds the MingGW install, but on the desktop the Reset to Defaults takes 1s and b arely loads the CPU, on the laptop it's a 10s long process with 100% CPU all the time.

Offline Commaster

  • Almost regular
  • **
  • Posts: 129
Re: 20.3 Slow to launch on SSD Laptop
« Reply #5 on: July 08, 2021, 04:06:28 am »
But what is at the top in "Task Manager", "Details" tab (NOT the default "Processes" tab), sorted descending by "CPU"? (Maybe you have to click the arrow-down "More details" first to see the tabs) I hope it's Code::Blocks...
You can also increase the refresh rate in the top menu - "View" - "Update speed" - High.

You might also be in Power Save mode on your laptop and just not have enough GHz to go around and launch quicker.
« Last Edit: July 08, 2021, 04:08:06 am by Commaster »

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #6 on: July 08, 2021, 06:13:14 am »
Commaster, yes on the Details tab.

Code::Blocks on launch momentarily becomes top CPU usage at about 24%, then it's Status becomes Not Reponding and drops down the list with ~7% CPU while it's icon flashes sideways slowly in the Taskbar.

iType becoming the dominant CPU process with 22% CPU until CODE::BLOCKS opens fully. This behaviour is the same under Normal or High update speed.

Typically the other top are Details(CPU) are System Idle(40~60%) and Antivirus(20~30%).
« Last Edit: July 08, 2021, 06:14:59 am by cpcfreak »

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #7 on: July 09, 2021, 02:06:18 am »
I've tried a few install variations overnight, and found the primary problem is the very slow parsing of the default plugins folder, about two seconds per plugin present. As yet I have not found out what the cause is, at this stage it doesn't appear to be antivirus related as I tried both adding an exception and removing the antivirus with no obvious impact on startup performance.

I did find something interesting, as a test I moved the default plugins into a sub-folder, this stopped them loading but they are still very slowly parsed at Code::Blocks launch even though they are not loaded. If I move them out of the plugins folder altogether or rename the plugins folder launch happens in a split second.

PS;
Further testing plugins one by one, it appears the problem is caused by the presence of the compiler plugin 0.99, remove it and launch happens in a split second but obviously it's not useful to have that plugin absent. If anyone knows what the plugin does during loading I'm happy to run some further tests to get a better idea of what might be the cause.
« Last Edit: July 09, 2021, 02:33:14 am by cpcfreak »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7191
    • My Best Post
Re: 20.3 Slow to launch on SSD Laptop
« Reply #8 on: July 09, 2021, 03:02:37 am »
Instead of renaming or moving the plugin folder; did you try to disable all the plugin except for Compiler and the search plugins?

Note: From memory one of the search plugins causes CB to crash when disabled.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #9 on: July 09, 2021, 03:30:33 am »
Hi Tim, thanks for the reply.

I tried disabling all plugins except compiler through the Manage Plugins, I have no listed Search plugins, I reverted to a clean Standard install so I might not have all the plugins of a full install.

The launch delay still occurs with just the compiler plugin enabled.

I had a play with some of the suggestions from AndrewCot in the linked thread here about removing default compiler sets https://forums.codeblocks.org/index.php/topic,24564.msg167676.html#msg167676

It does appear that the launch delay is related to very slow parsing of the <compiler ....... sets> from AppData\Roaming\CodeBlocks\default.conf
« Last Edit: July 09, 2021, 03:36:49 am by cpcfreak »

Offline AndrewCot

  • Almost regular
  • **
  • Posts: 244
Re: 20.3 Slow to launch on SSD Laptop
« Reply #10 on: July 09, 2021, 07:09:02 am »
Th XML file parsing is not very complex. Have you been moding the compiler or options XML files? If you have can you post them so I can see if these are the problem.

Can you try the following to see where the issue may be:
1) Rename the %APPDATA%\CodeBlocks directory to  %APPDATA%\CodeBlocks_Backup
2) Start codeblocks
3a) If it was fast can you post the default.conf file so people can have a look at it. You then haev two options restored the backup directory or setup the default compiler, debugger and any settigns you have changed. It may be worth diffing the new and backup default.conf to see what you configured if you cannot remember or just want to see the differences are
3b) If it was slow can you do the following:
i) Rename the "C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\compilers" directory to "C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\compilers_backup".
ii) download the latest nightly zip file and unzip it into a temp directory.
iii) Create the "C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\compilers" directory
iv) Copy the files in the compiler directory from the nightly zip file into the compilers directory.
v) Run CB again and see if it fast or slow. If it is fast can you zip up the "C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\compilers_backup" and post it so people can have a look at it. If its slow I am out of things to try, Sorry.
vi) Compare the backup and new compiler directory files to ensure they are the same and if they are delete the backup. If there are differences you cannot explain post details as they may be relevant.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13439
    • Travis build status
Re: 20.3 Slow to launch on SSD Laptop
« Reply #11 on: July 09, 2021, 11:01:36 am »
Without running a profiler it would be really hard to understand why it is so slow.
Have you tried a night build?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #12 on: July 12, 2021, 08:24:34 am »
OK, so I've tried the Nightlies with no success.

Renaming %APPDATA%/CodeBlocks, and replacing the share\CodeBlocks\compilers folder from the nightly made no difference.

Interestingly, removing MS Mouse and Keyboard Center has made a large difference, launch time has halved, the Code::BLocks no longer sits Not Rsponding for long if at all during launch. It's still quite a bit slower than the desktop which is weird for an SSD, but it's signifcantly better than it was.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13439
    • Travis build status
Re: 20.3 Slow to launch on SSD Laptop
« Reply #13 on: July 13, 2021, 11:49:50 pm »
C::B load time is CPU bound, not file-read bound.
Actually very few applications are really file-read bound...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #14 on: July 14, 2021, 07:58:43 am »
Thanks, and I suspect that for whatever reason when I launch C::B something in MS MKC conflicts and hogs the CPU via the iType application, maybe something related to custom keyboard mapping. Although the Details tab suggest CPU Idle time is high, and C::B makes little use of either CPU or Disk during the Plugin scanning phase when the compiler plugin is enabled.

Even when the compiler plugin is disabled and launch happens almost instantly (Maybe 5 ~ 10s) the C::B CPU and Disk use really doesn't change much from the slow to load state, so it looks to be quite a complex problem, not something trivial as I had hoped.

As an aside, I don't recall having these problems prior to 20.3, if I recall correctly 17.12 might have actually launched faster on the SSD laptop than it did on the HDD Desktop.
« Last Edit: July 14, 2021, 08:02:55 am by cpcfreak »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13439
    • Travis build status
Re: 20.3 Slow to launch on SSD Laptop
« Reply #15 on: July 14, 2021, 03:13:04 pm »
You continue to guess what the problem is. This rarely ends with solved problem. You need to use a profiler to see where time is spent. Unfortunately I cannot help much with windows guidance... Both ETW and VTune might be usable for find the root cause.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #16 on: July 16, 2021, 01:42:11 am »
Yes, thanks for the advice.

fwiw, I've given VTune a initial run and it's shown some anolmaly, in that when the C::B compiler plugin is enabled the CPU is idle for 70% of the time between launch and the GUI opening, so I'm not sure what that means if the problem is CPU bound.

I'll need a run quite a few variants on C::B launch to see if I can make sense of this, and if I find anything solid I'll report.

Offline cacb

  • Lives here!
  • ****
  • Posts: 506
Re: 20.3 Slow to launch on SSD Laptop
« Reply #17 on: July 16, 2021, 10:13:59 am »
There are two oddities in CPU usage during Code::Blocks launch as it is parsing the lexers, during that moment you see the program icon flashing on the taskbar.

Fwiw, I have a 4-5 year old laptop with Win10 and I just installed  codeblocks-20.03mingw-setup.exe on it. Once installed, it didn't detect the MinGW compiler, but it was easy to tell it to auto detect it.

Then, when starting Code::Blocks I observe the same icon flashing on the taskbar as you describe, however the process does not take much more than ~10 seconds. If I disable the compiler plugin, the icon flashing on the taskbar goes away, and the startup process is quicker. Once the compiler plugin is re-enabled, the icon-flashing returns, but it doesn't last very long. 


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13439
    • Travis build status
Re: 20.3 Slow to launch on SSD Laptop
« Reply #18 on: July 16, 2021, 09:08:40 pm »
fwiw, I've given VTune a initial run and it's shown some anolmaly, in that when the C::B compiler plugin is enabled the CPU is idle for 70% of the time between launch and the GUI opening, so I'm not sure what that means if the problem is CPU bound.
You need to do a system wide profile. C::B is starting many processes to do some stuff with them at startup (mainly compilers).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #19 on: July 17, 2021, 03:17:39 am »
Then, when starting Code::Blocks I observe the same icon flashing on the taskbar as you describe, however the process does not take much more than ~10 seconds. If I disable the compiler plugin, the icon flashing on the taskbar goes away, and the startup process is quicker. Once the compiler plugin is re-enabled, the icon-flashing returns, but it doesn't last very long.
Yes, noted, on my desktop HDD that is the experience, on the SSD laptop the launch process takes between 70s and 83s when testing with VTunes but only when the compiler plugin is enabled.

Offline cpcfreak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 20.3 Slow to launch on SSD Laptop
« Reply #20 on: July 17, 2021, 03:19:21 am »
You need to do a system wide profile. C::B is starting many processes to do some stuff with them at startup (mainly compilers).
Yes noted, I'll hopefully get to the bottom of hit and be able to post an update.

Thanks for all your assistance so far it's been invaluable.