I decided to try installing a YAML config from my Mac Studio M4 Max 16 core to save some time for really complex ESP devices.
However, it seems weirdly inconsistent and one time it used only 6% of my CPU (!!?) and took 125s and the very next time it used 55% and finished in 24 seconds cold.
So really I’m just curious how it handles multithreading/multicore and whether I can control that to allow more cores or even reduce them.
This is what it says initially when I run esphome compile /path/to/yaml.yaml
INFO Reading configuration lr-enviromon-esp.yaml...
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq/#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Setting CONFIG_LWIP_MAX_SOCKETS to 11 (registered: api=4, captive_portal=4, mdns=2, ota=1)
INFO Compiling app... Build path: /Users/Me/.esphome/build/lr-enviromon-esp
It uses multiple cores on the Home Assistant machine, That has 4 cores and it maxes those out when I run it there. And I’ve seen it use multiple cores on my Mac as well and I was just wondering if there was a way at all to use more, even just out of curiosity.
The default is to use the number of cores available. Parts of the process are single threaded, but once it starts the actual compilation process(es) it will use all available resources.
The first time it does things on a new install it has to download all the tools and platforms it needs. This takes time, but not a lot of system resources. Once those are downloaded, it doesn’t need to download them again, do things are typically quicker.
Ah now that is helpful. I still cannot figure out why it occasionally decides to only use one core but I suppose it isn’t super optimized for CLI vs HA addon
Also, looks like I can only specify up to 8 which is annoying lol. Maybe I can fiddle with the PlatformIO config manually.
For anyone wondering, I found another issue. Since I was specifying the path to the SMB Home Assistant YAML file, ESPHome CLI decided to also use the SMB as the main folder