You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: esptool is re-verified by spawning esptool version twice on every build (~130 ms, warm or cold) #1540
Every fbuild build — warm or cold, cache hit or miss — spawns the esptool Python entry point twice just to verify an already-installed, already-cached esptool. No build input changes between builds, so this is pure repeated work.
crates/fbuild-library/src/library/esptool.rs:
ensure_source_installed (:256) returns the cached tree from staged_install, then unconditionally calls verify_esptool_binary(&binary) at :277.
verify_esptool_binary (:400) spawns <esptool> version and parses the output.
Immediately after, :286 compares against self.expected_runtime_version, spawning versionagain.
There is a second, earlier call site at :227.
Each spawn is a Python interpreter startup (~60–100 ms), so this is roughly 130 ms per build that does not depend on build state at all.
Evidence
Measured on a 16-core Linux box, bench/blink -e esp32s3, via the daemon's FBUILD_PERF_LOG_JSON sink. In the cold trial the pioarduino-resolve phase — whose long pole is the tokio::join! awaiting resolve_esptool (crates/fbuild-build-esp/src/esp32/orchestrator/packages.rs:104) — took 364 ms; the log shows framework resolution finishing and provisioned esptool at ... landing ~132 ms later, i.e. esptool verification dominates the phase. The same ~140 ms appears on every warm build too.
Issue #1537 notes pioarduino-resolve at ~150 ms on CI against PlatformIO's 0.80 s total pre-compile, so this is a meaningful share of a phase that should be near-zero once the package is cached.
Suspected fix
Verify once per installed esptool version, not once per build — e.g. record the verified version alongside the install and skip re-spawning while it matches, or collapse the two version spawns in ensure_source_installed into one. Either way, a warm build should not need to start Python at all.
Activity