QGIS – How to Fix Extreme Slowness

pyqgisqgisqgis-3qgis-plugins

I am developing plugins and for some reason my QGIS keeps getting slower and slower. At first when I clicked on QGIS it opened right away, now it takes at least 2 minutes just to open and it also can take up to one minute just to close. Going into Manage and install plugins now times out because it takes forever to open. The way I'm pushing my changes is with this:

@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W64
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat

@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass78\lib
path %PATH%;C:\OSGeo4W64\apps\Qt5\bin
path %PATH%;C:\OSGeo4W64\apps\Python37\Scripts

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37

set PATH=C:\Program Files\Git\bin;%PATH%

cmd.exe

Which is located in C:\OSGeo4W64. I then just type in pb_tool deploy in the directory of the plugin.

I tried reinstalling QGIS 3.10.7 but it didn't change anything. Also tried on QGIS 3.12 and 3.14 and it didn't change anything.

Looking for a way to fix my QGIS being so slow. My codes use a couple of files and they are quite large so I can't really post everything here, but I'm mostly using processing algorithms from qgis and grass and I use "memory:" and "TEMPORARY_OUTPUT" for QGIS and GRASS algorithms respectively.

Just tried the Plugin Load Times and it doesn't seem to be because of my plugins:
enter image description here

Also here's the QGIS consumption when I just opened it and I have yet to even open a new project:
enter image description here


The problem seems to be coming from my QGIS3.ini. When I create a new user it's size is only 13KB while the default one is 547,018KB. The new profile's QGIS3.ini looks like this:
enter image description here

But the older one is actually insane it looks like this:
enter image description here

The [UI] part contains hundreds of millions of characters by itself and I don't know why.

Best Answer

So after taking into account what ThomasG77 told me to fix my QGIS, I've found that indeed creating a new profile fixes the slowdown, but I didn't want to have to create a new profile everytime it got this slow, then reinstall my plugins,etc. The problem does seem to lie with the QGIS3.ini which kept getting bigger and bigger (After creating a new profile I saw that the default QGIS3.ini which I was using was 42000 times bigger than the one that you begin with from scratch).

However I found a simple solution to fix it without having to delete anything or create a new profile. You simply need to open QGIS, go in Settings > Options... > System. Then under "Settings" you'll see this: enter image description here

I tried it and this not only reset my QGIS3.ini from 547k KB to 59KB, but it also kept all of the plugins I'd installed. Now it opens super fast again and everything works as it should.

Alternatively, creating a new profile does work if you're scared that doing the reset will affect some changes you've made, but as for myself the reset accomplished everything I needed it to do.

Related Question