The compilation suddenly became very slow

The compilation suddenly became very slow, taking more than ten minutes, whereas it used to take only about one minute before. I have tested it on two different computers with different versions of PlatformIO.

Please provide a MRE (minimal reproducible example)

PlatformIO Core: 6.1.18 Home: 3.4.4
Does compiling need to go through your server? Because I’m in China, even the simplest projects take a long time to compile.

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println("hello world");
}

What’s the content of your platformio.ini?

No, compiling is done completely locally. But there might be some dependencies etc in your platformio.ini which requires a download.

Is it really the compiling stage what takes so long?

It takes 860 seconds to compile

[env:esp8285]
platform = espressif8266
board = esp8285
framework = arduino
...
Linking .pio/build/esp8285/firmware.elf
Retrieving maximum program size .pio/build/esp8285/firmware.elf
Checking size .pio/build/esp8285/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  34.3% (used 28088 bytes from 81920 bytes)
Flash: [===       ]  34.8% (used 265095 bytes from 761840 bytes)
Building .pio/build/esp8285/firmware.bin
/home/sivar2311/.platformio/packages/framework-arduinoespressif8266/tools/elf2bin.py:54: SyntaxWarning: invalid escape sequence '\s'
  words = re.split('\s+', line)
/home/sivar2311/.platformio/packages/framework-arduinoespressif8266/tools/elf2bin.py:73: SyntaxWarning: invalid escape sequence '\s'
  words = re.split('\s+', line)
Creating BIN file ".pio/build/esp8285/firmware.bin" using "/home/sivar2311/.platformio/packages/framework-arduinoespressif8266/bootloaders/eboot/eboot.elf" and ".pio/build/esp8285/firmware.elf"
=================================================== [SUCCESS] Took 6.59 seconds ===================================================
 *  Terminal will be reused by tasks, press any key to close it. 

6.59 seconds.
So usually this should be finished within under a minute - even on a slow computer.

Are you on Windows?

Yes. I am on windows11


Retrieving maximum program size .pio\build\esp8285\firmware.elf
Checking size .pio\build\esp8285\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  34.3% (used 28088 bytes from 81920 bytes)     
Flash: [===       ]  34.8% (used 265095 bytes from 761840 bytes)
=================== [SUCCESS] Took 1.55 seconds ===================
 *  Terminal will be reused by tasks, press any key to close it. 

Second compile.
Win11.

I think somethings wrong with your system.
You can try to compile in WSL which should give you an incredible speed boost.

Holy cow, 860 seconds?

I’m getting flashbacks from the Extremely Slow Build Times on Windows 11 – Long Freezes During Compilation thread.

I’m also getting flashbacks from obscure chinese forums where similiar problems where reported:

https://wch.cn/bbs/thread-141195-1.html

Thank you for your response!
It works

1 Like

What was the exact solution? Removing MS-PC Manager?

Crazy how bad Microsoft Windows 11 is. An update killing performance this badly, and Microsoft doesn’t fix it immediately?

Some more source:

Affected users have observed the following typical phenomena:

Insufficient CPU core utilization: During compilation, the Task Manager shows that only a few CPU cores are active, with most cores idle

Root Cause

After thorough investigation, the root cause was identified as the Microsoft PC Manager service in the Windows 11 24H2 system. Specifically:

The background process MSPCManagerService.exe interferes with system resource scheduling
This service may incorrectly restrict the multi-threaded parallel processing capabilities during the ESP-IDF compilation process
Service priority settings may prevent compilation tasks from obtaining sufficient CPU time slices