From 7c29d0d1c0f065c8d88e674ac2f0ca3c3bd2ba37 Mon Sep 17 00:00:00 2001 From: Ammar Date: Thu, 16 Oct 2025 21:42:16 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Optimize=20`make=20static-ch?= =?UTF-8?q?eck`=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Speeds up static-check from 18.5s to 4.8s for incremental changes (74% improvement). **Changes:** 1. **Enable parallel-by-default** - Add MAKEFLAGS += -j to Makefile - Independent checks (lint, typecheck, fmt-check, etc.) now run concurrently - 18.5s → 13s for cold cache 2. **Enable ESLint caching** - Add --cache flag to scripts/lint.sh - Caches lint results per file, only re-lints changed files - 13s → ~1s for incremental changes (only changed files re-linted) - Cache file (.eslintcache) is gitignored **Performance:** - Cold cache (CI): 18.5s → 13s (30% faster) - Hot cache (dev): 18.5s → 4.8s (74% faster) **Safety:** - Targets requiring sequential execution use .NOTPARALLEL (already in place) - ESLint cache invalidates automatically on config changes - No change to CI behavior (cache starts empty) _Generated with `cmux`_ --- .gitignore | 3 +++ Makefile | 6 +++++- scripts/lint.sh | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index cae3d3d4b..c32901afa 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,9 @@ yarn-error.log # testing /coverage +# ESLint cache for faster incremental lints +.eslintcache + # Bun bun.lockb dist diff --git a/Makefile b/Makefile index 7c1beb3b8..002490374 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ # make test - Run tests # # Parallelism: -# Use make -jN to run independent tasks concurrently (e.g., make -j4 build) +# Runs in parallel by default for faster builds. Use -j1 for sequential execution. +# Individual targets can opt out with .NOTPARALLEL if needed. # # Backwards Compatibility: # All commands also work via `bun run` (e.g., `bun run dev` calls `make dev`) @@ -23,6 +24,9 @@ # Branches reduce reproducibility - builds should fail fast with clear errors # if dependencies are missing, not silently fall back to different behavior. +# Enable parallel execution by default +MAKEFLAGS += -j + # Include formatting rules include fmt.mk diff --git a/scripts/lint.sh b/scripts/lint.sh index 12bb096ba..3fa7d5953 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -26,9 +26,9 @@ ESLINT_PATTERN='src/**/*.{ts,tsx}' if [ "$1" = "--fix" ]; then echo "Running bun x eslint with --fix..." - bun x eslint "$ESLINT_PATTERN" --fix + bun x eslint --cache "$ESLINT_PATTERN" --fix else echo "Running eslint..." - bun x eslint "$ESLINT_PATTERN" + bun x eslint --cache "$ESLINT_PATTERN" echo "ESLint checks passed!" fi From 798d9a4986b224b2591a28d68bc634e2a15b77f4 Mon Sep 17 00:00:00 2001 From: Ammar Date: Thu, 16 Oct 2025 21:45:15 -0500 Subject: [PATCH 2/2] Fix: Respect user-provided -j flags in Makefile The previous implementation unconditionally set MAKEFLAGS += -j, which overrode user-provided -j flags (e.g., make -j1 would still run in parallel). Now we only default to parallel execution if the user didn't explicitly provide a -j flag, properly respecting their choice. _Generated with `cmux`_ --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 002490374..b9267dfe8 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,10 @@ # Branches reduce reproducibility - builds should fail fast with clear errors # if dependencies are missing, not silently fall back to different behavior. -# Enable parallel execution by default +# Enable parallel execution by default (only if user didn't specify -j) +ifeq (,$(filter -j%,$(MAKEFLAGS))) MAKEFLAGS += -j +endif # Include formatting rules include fmt.mk