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