PlatformIO is too slow building projects

I was working on an Arduino project and when I wanted to build it, it took a long time before PlatformIO started building it and it was the same for uploading.

What environment do you have? (IDE + version, platformio version, build times / logs, operating systemā€¦)

Any antivirus active on the system? Does make it a difference when itā€™s off?

Iā€™m using vscodes version 1.42.1, my platformIO version is 1.10.0 and Iā€™m on windows 10.
I havenā€™t used any antivirus software neither have one currently installed.

Whats your platformio.ini?

Iā€™m sorry what do you mean by that?

The project for which building is slow, whatā€™s the content of itā€™s platformio.ini file? Itā€™s the main configuration file in the project folder.

;PlatformIO Project Configuration File

;

;   Build options: build flags, source filter

;   Upload options: custom upload port, speed and extra flags

;   Library options: dependencies, extra library storages

;   Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:megaatmega2560]

platform = atmelavr

board = megaatmega2560

framework = arduino

Open a PIO terminal.

Then press enter once in the shell and run

pio run -t clean 
pio run 

Does some output appear immedeately if you execute the last pio run command? Is it faster compared to executing ā€œCleanā€ and ā€œBuildā€ via the VSCOde project task list?

Yes and itā€™s faster compared to running build via the task list.

Well then the issue somewhere within VSCode or the plugin and PIO compilation itself is working perfectly fine. I suggest to reinstall the VSCode PIO extension. If you want to nuke your entire previous PlatformIO installation you can also remove the C:\Users\<user>\.platformio folder.

Thanks I will try that.

+1 For this alsoā€¦ the responsiveness of building in VSCode on Windows 10 seems to have taken a real nosedive in the last several weeksā€¦ Iā€™m unclear as to whether it is VSCode, my anti-virus (Bitdefender 2020), or Windows 10 gone berko thoughā€¦ I tend to think it is VSCode as it seemed to get worse after the 1.42.x updateā€¦ And I have once again gone back to Linux for anything ā€˜compileā€™ related as VSCode + PlatformIO is working great there, as is just so fastā€¦ compiling and uploading to a Pro Micro without a DTR line connected (i.e. needing manual reset) is almost too fast thereā€¦ barely have enough time between pressing ā€˜build and uploadā€™ and being able to fumble for that reset button so the upload can happen! :slight_smile:

I now occasionally get complete lockups from VSCode when trying to build and upload and it sometimes takes several seconds to actually start a task. It is responsive in starting from the CLI, but compile speed is slow - the normal just Windblows standard + AV sluggishness/laggyness.

Edit: Also, Iā€™m often getting the syntax highlighting corruption someone else recently mentioned, again on Windows onlyā€¦ have to swap to another tab and back again to get it to render properly. :man_facepalming:

Thank you. reinstalling platformIO worked

1 Like