How I fixed IDE slow to start

Share your advanced PureBasic knowledge/code with the community.
BarryG
Addict
Addict
Posts: 3320
Joined: Thu Apr 18, 2019 8:17 am

How I fixed IDE slow to start

Post by BarryG »

[Edit] Post title edited to show that I fixed my slow starts; I wasn't asking for help about it. This is a tip. :wink:

Hi everyone. I noticed recently that PureBasic's IDE (editor) was starting very slowly (to load my large source) on Windows 10. My source is over 1 MB in size now, and double-clicking it would make the IDE unresponsive for about 45 seconds. Literally - I timed it! I tried all the usual tricks to "fix" it, such as disabling my anti-virus (Windows Defender), disabling syntax highlighting, disabling session history, and even starting with a default "PureBasic.prefs" file (by deleting the existing one). Nothing worked.

But today I remembered that about week or so ago, I enabled "Memory integrity" in Win 10's "Core isolation" settings (under "Device security"). So I tried disabling this again (reverting it back to "Off") and it immediately fixed the problem! Now my big source loads in about 5 seconds - the slow starts have gone. An amazing speed difference!

Below is a screenshot for future reference to help anyone else who may experience this. Merry Christmas!

Image
Last edited by BarryG on Tue Dec 24, 2019 11:12 pm, edited 1 time in total.
BarryG
Addict
Addict
Posts: 3320
Joined: Thu Apr 18, 2019 8:17 am

Re: Fix for IDE slow to start

Post by BarryG »

BTW, why would the IDE be affected by this setting? What's it doing in the background that freaks out Win 10 like that?
marc_256
Enthusiast
Enthusiast
Posts: 744
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Fix for IDE slow to start

Post by marc_256 »

Hi BarryG,

this is so since 2012,
see my post here viewtopic.php?f=18&t=51480

never had a working answer for this problem,
so, I use notepad++ now since years to edit my (large) programs,
and only use PB IDE for compiling stuff.

Load program 3min10sec
Just moving cursor one step to the right, 1min 20sec
adding one character 1min 15sec
adding space 1min 20sec ...

WIN 7, 8 and 10, always the same problem ...

*** Are you using a lot of variables ? ***

marc

PS: I have somewhere some test programs I made ...
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
marc_256
Enthusiast
Enthusiast
Posts: 744
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Fix for IDE slow to start

Post by marc_256 »

BarryG,

Can you test this for me ...

First create a file with this program,
after that, thy to open "MemoryGlobalVariablesTest.pbi" in the PB IDE,
It is only 40000 lines long with lots of variables ...

Load file 4min 05sec
Move mouse to a line you want to edit, and click left mouse button,
about 2min 15sec before any IDE reaction ...

I use now WIN10 Home, 16GB ram PB 5.71 LTS Final x64

Code: Select all

;----------------------------------------------------------------------------------------------------------------------------------
;- STARTUP ZONE
;----------------------------------------------------------------------------------------------------------------------------------
EnableExplicit

;----------------------------------------------------------------------------------------------------------------------------------
;- CONSTANTES ZONE
;----------------------------------------------------------------------------------------------------------------------------------
#pvg_TextLeft_b = %00000001
#pvg_TextCenter_b = %00000010
#pvg_TextRight_b = %00000100

#pvg_TextTop_b = %00010000
#pvg_TextMiddle_b = %00100000
#pvg_TextBottom_b = %01000000

;----------------------------------------------------------------------------------------------------------------------------------
#byte = 1
#word = 2
#long = 4
#integer = 4
#single = 4
#double = 8
#stringS = 128
#stringL = 256

;----------------------------------------------------------------------------------------------------------------------------------
;- GLOBALS ZONE
;----------------------------------------------------------------------------------------------------------------------------------
Global Counter.l
Global Quantity.l

;----------------------------------------------------------------------------------------------------------------------------------
;- INITS ZONE
;----------------------------------------------------------------------------------------------------------------------------------
Quantity = 10000			;8000

;----------------------------------------------------------------------------------------------------------------------------------
;- MEMORY ZONE
;----------------------------------------------------------------------------------------------------------------------------------
Global *CommandBuffer = AllocateMemory (10000)

Global *DataBuffer = AllocateMemory (100000)

Global TestString.s = "This is a auto created test file string, so this is not importent at all ..."

;----------------------------------------------------------------------------------------------------------------------------------
If OpenFile (0, "MemoryGlobalVariablesTest.pbi")

;	WriteStringN (0, ";============================================================================================")
;	WriteStringN (0, ";- GLOBAL VARIABLES")
;	WriteStringN (0, ";============================================================================================")
;	WriteStringN (0, "")
	WriteStringN (0, ";============================================================================================")
	WriteStringN (0, ";- !!!!!                      THIS IS A NOT WORKING PROGRAM ...                        !!!!! ")
	WriteStringN (0, ";- !!!!!                         THIS IS A TEST FILE ...                               !!!!! ")
	WriteStringN (0, ";============================================================================================")
	WriteStringN (0, "; !!!!!               THIS IS NOT A COMPILER ERROR BUT IDE PROBLEM ...                 !!!!! ")
	WriteStringN (0, ";============================================================================================")
	WriteStringN (0, "")

;----------------------------------------------------------------------------------------------------------------------------------
	WriteStringN (0, "#byte = 1")
	WriteStringN (0, "#word = 2")
	WriteStringN (0, "#long = 4")
	WriteStringN (0, "#integer = 4")
	WriteStringN (0, "#single = 4")
	WriteStringN (0, "#double = 8")
	WriteStringN (0, "#stringS = 128")
	WriteStringN (0, "#stringL = 256")

;----------------------------------------------------------------------------------------------------------------------------------



;==================================================================================================================================
;- MEMORY ZONE
;----------------------------------------------------------------------------------------------------------------------------------
;*CommandBuffer = AllocateMemory (10000)						; 10000 Bytes = +-10 KB

	WriteStringN (0, "Global *DataBuffer = AllocateMemory (100000)

;----------------------------------------------------------------------------------------------------------------------------------
;- BYTE MEMORY
;----------------------------------------------------------------------------------------------------------------------------------
	WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (0, #PB_Word) + "_Byte = *DataBuffer")
	For Counter = 1 To Quantity
		WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (Counter, #PB_Word) + "_Byte = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Word) + "_Byte + #byte")
	Next Counter

;----------------------------------------------------------------------------------------------------------------------------------
;- WORD MEMORY
;----------------------------------------------------------------------------------------------------------------------------------
	WriteStringN (0, "")

	WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (0, #PB_Word) + "_Word = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Long) + "_Byte + #word")
	For Counter = 1 To Quantity
		WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (Counter, #PB_Word) + "_Word = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Long) + "_Word + #word")
	Next Counter

;----------------------------------------------------------------------------------------------------------------------------------
;- LONG MEMORY
;----------------------------------------------------------------------------------------------------------------------------------
	WriteStringN (0, "")

	WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (0, #PB_Word) + "_Long = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Long) + "_Word + #long")
	For Counter = 1 To Quantity
		WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (Counter, #PB_Word) + "_Long = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Long) + "_Long + #long")
	Next Counter


;----------------------------------------------------------------------------------------------------------------------------------
;- STRING MEMORY
;----------------------------------------------------------------------------------------------------------------------------------
	WriteStringN (0, "")

	WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (0, #PB_Word) + "_String = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Long) + "_Long + #stringS")
	For Counter = 1 To Quantity
		WriteStringN (0, "Global *pvg_Container_Setup_" + StrU (Counter, #PB_Word) + "_String = *pvg_Container_Setup_" + StrU (Counter-1, #PB_Long) + "_Long + #stringS")
	Next Counter

	WriteStringN (0, "")
	WriteStringN (0, "")
	WriteStringN (0, "Debug *DataBuffer")
	WriteStringN (0, "")
	WriteStringN (0, "Debug *pvg_Container_Setup_10000_Byte")
	WriteStringN (0, "Debug *pvg_Container_Setup_10000_Word")
	WriteStringN (0, "Debug *pvg_Container_Setup_10000_Long")
	WriteStringN (0, "Debug *pvg_Container_Setup_10000_String")
	WriteStringN (0, "")
	WriteStringN (0, "Debug *pvg_Container_Setup_10000_String - *DataBuffer")

	CloseFile (0)
EndIf



thanks,
marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Fix for IDE slow to start

Post by Tenaja »

Performance issues aside, I cannot imagine a 1M LOC program that could not be broken down into at least a dozen (or 20 dozen) separate files--and it would likely benefit from the breakup, as well. The way most people edit code is section by section, rather than simultaneously editing unrelated sections or areas.
BarryG
Addict
Addict
Posts: 3320
Joined: Thu Apr 18, 2019 8:17 am

Re: Fix for IDE slow to start

Post by BarryG »

Thanks for you guys taking the time to reply, but my post wasn't asking for help. It was a tip to show how I fixed the IDE being slow to start in my situation, and I posted it in case it helps someone else when they've tried "everything else", such as breaking down their sources into IncludeFiles, etc. It's just another thing to check because in my case, Windows itself was the cause of the slow IDE startup - nothing I did or tweaked with PureBasic or my source was ever going to make the IDE start faster.

@marc_256: I do have a lot of variables, but I don't know how many. Over 100. I also tried your code (had to fix line 81 to make it compile) and then tried to load the 3 MB+ source that it generated, but got tired of waiting for it to load, so killed the PureBasic.exe process.

@Tenaja: My app is already broken down into lots of IncludeFiles. Sometimes the main source is just big anyway - I'm not going to stick every BindEvent() into its own file, for example. Also, too many IncludeFiles makes it a hassle to search and/or replace something; and can ruin your app if you search/replace something by mistake and then don't know which files were affected. With one source you can just Ctrl+Z the changes.

So again, thanks for replying, but it's all sorted and okay.
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: How I fixed IDE slow to start

Post by Tenaja »

Thanks for the tip. If I ever have this issue, it should be easy to find in the forum!
Post Reply