velxio/backend/app/services
davidmonterocrespo24 4908525692 perf(espidf): drop in ccache for ESP32 compiles (~10× warm speedup)
Cold first compile per container is unchanged (cache empty). Subsequent
compiles drop from ~5-7 minutes to ~30-60 seconds because every ESP-IDF
base object (FreeRTOS, lwIP, esp_wifi, libsodium, soc, hal, …) hits the
cache. The user's BMP280 example, which hangs on cold compile, completes
near-instantly on the second attempt.

Why a transparent cache is safe: ccache hashes the preprocessed source +
flags + compiler. A cache hit only happens when the input is byte-for-byte
identical to a prior compile. Different sketches with different libraries
still get correct cache misses; there is no path where one project's
output contaminates another.

Changes
- Dockerfile.standalone: install ccache, set CCACHE_DIR=/var/cache/ccache,
  IDF_CCACHE_ENABLE=1, configure 2 GB cap with compression. Compression
  (level 6) cuts cache disk usage by ~40% with negligible CPU overhead.
- docker-compose.yml: named volume `ccache:/var/cache/ccache` so the
  cache survives `docker compose up -d --build` (without it, every image
  rebuild discards the cache).
- backend/app/services/espidf_compiler.py: pass `-DCCACHE_ENABLE=1` to
  cmake when IDF_CCACHE_ENABLE is truthy. ESP-IDF's project.cmake
  (`set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)` on line 374)
  is what actually wires ccache in; without the cmake -D flag the env
  var alone has no effect because we don't go through idf.py.

Escape hatch: set IDF_CCACHE_ENABLE=0 in compose env to disable without
rebuilding the image.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 05:44:29 +02:00
..
esp-idf-template feat(esp32): velxio_compat.h shim for arduino-esp32 3.x APIs on 2.0.17 2026-05-08 16:32:12 -03:00
picow_net Implement TCP and UDP NAT services for chip-initiated connections 2026-04-29 08:43:41 -03:00
__init__.py
arduino_cli.py feat: Add library version management and uninstall functionality 2026-05-02 12:54:09 +05:30
chip_compile.py Add ESP32 chip demos and comprehensive tests for I2C, SPI, and UART interactions 2026-04-28 19:24:39 -03:00
esp32_flash_image.py fix(esp32): trim flash image before serializing, pad on QEMU attach 2026-05-08 14:36:34 -03:00
esp32_i2c_slaves.py feat: add BMP280 sensor component and circuit preview 2026-04-14 17:27:30 -03:00
esp32_lib_bridge.py fix(esp32): trim flash image before serializing, pad on QEMU attach 2026-05-08 14:36:34 -03:00
esp32_lib_manager.py feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
esp32_spi_slaves.py feat: add support for UC8159c (ACeP 7-colour) display 2026-04-30 00:27:40 -03:00
esp32_worker.py fix(esp32): worker subprocess fallback for esp32_flash_image import 2026-05-08 22:22:53 -03:00
esp_qemu_manager.py feat: implement ESP32 QEMU backend manager and frontend simulation interface 2026-04-01 22:41:52 -03:00
espidf_compiler.py perf(espidf): drop in ccache for ESP32 compiles (~10× warm speedup) 2026-05-09 05:44:29 +02:00
gpio_shim.py
metrics.py feat(metrics): add usage analytics dashboard with country tracking 2026-04-25 19:47:40 -03:00
picow_net_bridge.py Implement TCP and UDP NAT services for chip-initiated connections 2026-04-29 08:43:41 -03:00
project_files.py feat: persist multi-board projects + add auto-save 2026-05-01 13:43:33 -03:00
qemu_manager.py
wasm_chip_runtime.py Add ESP32 chip demos and comprehensive tests for I2C, SPI, and UART interactions 2026-04-28 19:24:39 -03:00
wasm_chip_slave.py Add ESP32 chip demos and comprehensive tests for I2C, SPI, and UART interactions 2026-04-28 19:24:39 -03:00
wifi_status_parser.py feat: implement ESP32 QEMU backend manager and frontend simulation interface 2026-04-01 22:41:52 -03:00