Skip to content

Commit 34e01b9

Browse files
authored
🤖 Optimize make static-check (74% faster) (#288)
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) run concurrently - Cold cache: 18.5s → 13s 2. **Enable ESLint caching** - Add `--cache` flag to scripts/lint.sh - Caches lint results per file, only re-lints changed files - Incremental: 13s → ~1s (only changed files re-linted) ## Performance | Scenario | Before | After | Improvement | |----------|--------|-------|-------------| | Cold cache (CI) | 18.5s | 13s | 30% faster | | Hot cache (dev) | 18.5s | 4.8s | **74% faster** | ## Implementation Details ### Parallel-by-default - Added `MAKEFLAGS += -j` to enable parallel execution by default - Updated documentation to reflect new behavior (use `-j1` for sequential) - Existing `.NOTPARALLEL` directive for build-main ensures safety where needed ### ESLint cache - Cache file (`.eslintcache`) stores lint results keyed by file content - Automatically invalidates on ESLint config changes - Gitignored to avoid committing cache state ## Testing Verified performance with: - Clean cache (simulates CI): Full lint takes 13s - Hot cache + small change: Lint takes ~1s (only changed files) - Full static-check with hot cache: 4.8s total _Generated with `cmux`_
1 parent b2b3999 commit 34e01b9

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ yarn-error.log
5353
# testing
5454
/coverage
5555

56+
# ESLint cache for faster incremental lints
57+
.eslintcache
58+
5659
# Bun
5760
bun.lockb
5861
dist

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# make test - Run tests
1111
#
1212
# Parallelism:
13-
# Use make -jN to run independent tasks concurrently (e.g., make -j4 build)
13+
# Runs in parallel by default for faster builds. Use -j1 for sequential execution.
14+
# Individual targets can opt out with .NOTPARALLEL if needed.
1415
#
1516
# Backwards Compatibility:
1617
# All commands also work via `bun run` (e.g., `bun run dev` calls `make dev`)
@@ -23,6 +24,11 @@
2324
# Branches reduce reproducibility - builds should fail fast with clear errors
2425
# if dependencies are missing, not silently fall back to different behavior.
2526

27+
# Enable parallel execution by default (only if user didn't specify -j)
28+
ifeq (,$(filter -j%,$(MAKEFLAGS)))
29+
MAKEFLAGS += -j
30+
endif
31+
2632
# Include formatting rules
2733
include fmt.mk
2834

scripts/lint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ ESLINT_PATTERN='src/**/*.{ts,tsx}'
2626

2727
if [ "$1" = "--fix" ]; then
2828
echo "Running bun x eslint with --fix..."
29-
bun x eslint "$ESLINT_PATTERN" --fix
29+
bun x eslint --cache "$ESLINT_PATTERN" --fix
3030
else
3131
echo "Running eslint..."
32-
bun x eslint "$ESLINT_PATTERN"
32+
bun x eslint --cache "$ESLINT_PATTERN"
3333
echo "ESLint checks passed!"
3434
fi

0 commit comments

Comments
 (0)