News:

Let's find out together what makes a PIC Tick!

Main Menu

How to speed up compile time?

Started by PicNoob, Dec 22, 2021, 09:22 PM

Previous topic - Next topic

PicNoob

Hey guys,

Running proton for a variety of 18F chips using the external CANbus library when compiling. And my compiling time is super slow, around 4 minutes!

The computer is an old i3 desktop with 8gb ram, SSD drive. From a hardware perspective what is most important for compiling speed, the processor? Thinking of dropping in an i7 if that might speed things up.

top204

#1
A faster processor and more RAM is always a good thing, but there are other issues that can slow a machine down.

The compilers use the file system for creating and passing information, as well as RAM for Lists, so make sure your files are not being hijacked by Anti-Virus programs that examine every last piece of data in them, looking for patterns. This takes time.

I had this problem on my I5 and I7 machines in the past and is why I always use a virtual machine for checking for trojans and virus' and my development machine has none and is never connected to the internet. I was amazed at how much faster the machine was without all the rubbish that is "normal" now!

Unfortunately, the latest virus checkers are much like virus' themselves and take control of your machine without you being asked, and can wipe files that are perfectly OK, but have a particular pattern that "could possibly be a problem", but is usually not. :-)

Also check on how many services are being run on your machine. The Windows O/S is dreadfully inefficient and slow in itself, but having hundreds of third party or unnecessary services all running in the background, for no real reason, can slow things down a lot. The same with programs that have been installed and they add a whole bunch of "operating in the background" tasks. Go into "msconfig" (start menu, then type in msconfig) and stop them from running or starting up in the first place when the OS starts.

If none of the above solve the problem, make sure your SSD is actually being run efficiently with the correct driver. The windows generic drive is not actually that good for SSD, and it is always better to get the manufacturer's driver if it is available.

Then add some extra RAM, and see if the programs speed up. If not, it's time for a new motherboard if not a processor. Yes... Motherboards are also a thing that can slow down a processor because they do not always have the capabilities of higher speeds and not enough caching, or slower caching  etc...

PicNoob

Thanks for the tips. I have the virus/file checking stuff disabled. I'll open it up and see if I can pop in an older i7 with the same motherboard to see if I can quantify the difference it makes as a % of compile time. Will report back if I find anything interesting!

trastikata

Hi,

I am using an old Laptop with 2-core i3@1.9GHz with 8Gb RAM and SSD. Thus comparable with your PC.

Even the largest programs for 18F devices, which occupy about 63-64Kb, take at most a minute to compile, including optimization and dead code removal.

So I think you have a Windows issue or some other installation problem. Sometimes bad SSD drives slow down the system when reading/writing files in problematic sectors.

John Drew

I've found that programs with provisional compile statements in include files really slow down my compiler.
John

PicNoob

I swapped the i3 3.5ghz out for a i7 3.6ghz (highest power processor the MB will support). And the compile time dropped from 4:05 down to 2:48. Still annoyingly long but enough to justify the $160 upgrade at least.

I suspect part of the issue is related to the external CAN library I'm using with proton, when I get some time I'll hard code that all out of a program to see if it speeds things up. I have some other smaller programs on different non-CAN chips (26k80 with 24k22 without), that don't use the CAN library, and they compile in around 45 seconds.


RGV250

Hi John,
What version of the compiler are you using.
I only have an i5 (8gb ram) and don't have any issues when compiling although if you have upgraded to the latest version I doubt it would compile at all as a lot has changed.
I have a new version that uses procedures but it is not tested yet, I can send you that if you like but it is quite different.

Bob

PicNoob

#7
OK just for posterity I hard coded Bob's (very good) library just to see the impact on compile time without the library include and it further reduced the time but not a ton. From 2:48 down to 1.55. On the plus side I'm now more intimately more familiar with setting up CANbus registers than I'd like to be! :)




RGV250

Hi John,
I have just tried a compile with the new library I have and it was just under 9 seconds. This is with 4.0.1.3

Bob

Frizie

Leaving the optimizer turned off during the development of your program also saves time during compilation:

DECLARE OPTIMISER_LEVEL = 0
Ohm sweet Ohm | www.picbasic.nl