PlatformIO Community

PIO generally slow on Win10

Hi there.
I have the impression PIO is really slow on Win10 compared to quite outdated machines running Ubuntu.
If I do a simple pio --version on the shell it is almost instant on my Ubuntu machines, but takes ~5 seconds on my up-to-date Win10 pro (21H1) machine. It gets a bit better with switched of virus- and malwareprotection (~3s) but it is still unsatisfactory (as building on my Core 5000-series i5 8GB Ram X250 is about triple as fast (even sometimes finishes before it even started on win) as on my 8000-series i7 16GB machine…).
On Windows i use Python 3.9.7 and PlatformIO Core version 5.1.1. I did several pip install --upgrade platformio --force-reinstall with no effects.

Now I’m a little clueless. What could be the issue here?
Thanks in advance, Tobi

I’m running Linux Mint, which is Ubuntu based, and I sometimes see delays when running pio commands on the command line. Mostly it’s when I’m initialising a new projecgt with:

pio init -b uno

The code completes but then hangs for about 5-10 seconds before finishing the output. I always assumed that some file system syncing was going on to write down the created files to disc completely before getting back to the user to say “all done”.

Windows is a different kettle of fish.

Given that you have anti-virus and malware protection, it is going to tale longer. If you white list the PIO “stuff” then does it get any better – can you whitelist in the apps you have installed?

If you run the command a second time, immediately after the first, does it run quicker? Linux will cache recently read file system blocks, but I don;t know if Windows will do this too. No need to hit the disc again makes things quicker.

Even when whitelisted, attempting to execute the code will still be slower than if anti-virus and malware protection were completely disabled. I’m assuming (!) that there’s some kind of lookup to see if a command is whitelisted or not, before the command can be safely executed, or scanned?

I thought, at least a little while ago, that Python 3.9 caused problems when used on Windows with PlatformIO? 3.8 was advised. My Mint install is version 3.8.10. You could, if you are using VSCode as well for PlatformIO, configure VSCode to use the bundled version of Python that came with PlatformIO IDE – go to File->Preferences->Settings, serach for “builtin python” and select the option to use a portable python installation.

Also, you are not using the Python version from Windows Marketplace are you? If so, install the correct version from python.org – there are definitely problems with whatever Microsoft of offering on Marketplace.

HTH

Cheers,
Norm.

Can’t reproduce. 0.224 seconds to run pio --version on my machine, Win10 21H1, Ryzen 7 2700 (8 cores @ 3.20GHz), 16GB DDR4 RAM.

PS C:\Users\Max> Measure-Command { pio --version }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 224

3 to 5 seconds is extreme. The only thing I can think of is antivirus or some other hidden process slowing stuff down.

Hi.

Thanks for the answers!
Actually I’m using the win marketplace version of Python 3.9 which actually runs fine when you tweak it a little (you have to manually adjust path to point to the weird install directory. I know, i know… :wink: .
VERY curiously I woke my win10 machine from hibernation to answer your suggestions and things started running quicker from PowerShell (NOT within VSC)…:

PS C:\Users\tobia> Measure-Command {pio --version}

Days : 0
Hours : 0
Minutes : 0
Seconds : 1
Milliseconds : 617
Ticks : 16176594
[…]

and with all security disabled whatsoever:

PS C:\Users\tobia> Measure-Command {pio --version}

Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 659
Ticks : 6592288
[…]

Still it is 3x slower than on your machine (ok 8 cores vs 4 but comparable Win & RAM …). For building I was actually suspecting my backup-solution-indexing-process to interfere, but --version does not create or change any files.

As to the VSC-builtin python version: It seems to be a/the problem (output from PS within VSC):

PS […]\sx127xAPRS> Measure-Command {pio --version}

Days : 0
Hours : 0
Minutes : 0
Seconds : 3
Milliseconds : 196
Ticks : 31966026

With builtin python disabled and from VSC-PS:

PS […]\sx127xAPRS> Measure-Command {pio --version}

Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 880
Ticks : 8805316

The builtin python is also Python 3.9.7

Things start to get weird. Maybe the builtin python-version (or vice-versa) and the system python somehow use each others libraries or something else weird…?

Cheers, Tobi

When you run pio system info in both an external powershell and in VSCode, do they show the same Python Executable value? Can you post the full output in both environments?

The way I’ve installed PlatformIO is with Python 3.8.6 + pip install platformio, aka, installing it directly in my system’s Python installation. I think I either never used or removed the Microsoft Store version of python3 on my computer. That installation method is not recommended though, one should use the installer script or the regular installation through the VSCode PlatformIO extension with no prior PlatformIO core installed, that will install PlatformIO in an isolated PyEnv in <home>/.platformio/penv. The speed should be the same, it’s just that it’s calling into another Python executable.

If there’s duplicate PlatformIO core installations though in one or another Python installation, that’s not good.

So I completely removed all (previous) installations (incl. all mentions of ‘python’ in PATH) of Python from the system. I then freshly downoaded 3.9.7 and installed it. When I disable the builtin python in vsc both “instances” (powershell and vsc) need a bit over 800ms for --version. PIO system info says the folowing:

pio system info


PlatformIO Core 5.1.1
Python 3.9.7-final.0
System Type windows_amd64
Platform Windows-10
File System Encoding utf-8
Locale Encoding cp1252
PlatformIO Core Directory C:\Users\tobia.platformio
PlatformIO Core Executable C:\Users\tobia\AppData\Roaming\Python\Python39\Scripts\platformio.exe
Python Executable C:\Program Files\Python39\python.exe
Global Libraries 24
Development Platforms 11
Tools & Toolchains 49


If I enable the builtin python thingsstay the same:

PS […]\sx127xAPRS> pio system info


PlatformIO Core 5.1.1
Python 3.9.7-final.0
System Type windows_amd64
Platform Windows-10
File System Encoding utf-8
Locale Encoding cp1252
PlatformIO Core Directory C:\Users\tobia.platformio
PlatformIO Core Executable C:\Users\tobia\AppData\Roaming\Python\Python39\Scripts\platformio.exe
Python Executable C:\Program Files\Python39\python.exe
Global Libraries 24
Development Platforms 11
Tools & Toolchains 49


Runtimes are now all a bit over 800ms (about 300…500ms w/ disabled security). So I think radically reinstalling python “fixed” things…? Still, building feels way quicker and snappier on Ubuntu. Maybe I can build an example project tomorrow and do a little performance benchmarking.