Big-O Complexity AnalyzerOffline, zero-config Time & Space Complexity (Big-O) analysis directly inside VS Code for JavaScript and TypeScript. Powered by the official TypeScript compiler AST (
Quick Access Cheat Sheet
Why This Was BuiltMost performance bugs in JavaScript and TypeScript do not come from slow syntax—they come from accidental asymptotic growth:
Existing tools are typically either cloud/AI-based (requiring API keys, sending code externally, and adding seconds of latency) or single-function toy analyzers that miss helper composition. This extension was built to give engineers instant, deterministic, offline feedback right above every function header while keeping the analyzer core completely pure and unit-testable. Installing in VS CodeFrom the VS Code Marketplace (once published)Search the Extensions view (
Or install via Quick Open (
From a Local
|
| Construct | Time Estimate | Space Estimate |
|---|---|---|
Plain expressions / constant-bounded for (<= 1000) |
O(1) |
O(1) |
Halving / doubling loops (*= 2, /= 2, >> 1 midpoint) |
O(log n) |
O(1) |
Square-root bounded loops (i * i <= n, i <= Math.sqrt(n)) |
O(√n) |
O(1) |
Single loop (for, for-of, for-in, while, do-while) or .map/.filter/.includes |
O(n) |
O(1) (or O(n) if allocating) |
.sort() standalone / Divide-and-conquer (mergeSort) / .sort() in loop |
O(n log n) / O(n * m log m) |
O(1) / O(n) |
Spread in loop or .reduce(), .shift()/.splice() in loop, JSON/Object.* in loop |
O(n²)+ |
Scales with allocations |
Nested loops / nested array methods (depth k) |
O(n²), O(n³), O(n^k) |
Scales with nested allocations |
| Linear recursion / Memoized recursion | O(n) |
O(n) call stack |
| Branching recursion (2+ recursive calls without memoization or split) | O(2^n) |
O(n) call stack |
Dashboard, Quick Fixes & Workspace Audit

- Interactive Big-O Dashboard (
Big-O: Open Complexity Dashboard): Click the📊graph icon in the editor toolbar or click the bottom-right status bar item to view an interactive SVG Big-O growth chart with an input-sizenslider, worst-first function breakdown, and click-to-jump navigation. - Workspace Hotspot Scan (
Big-O: Scan Workspace Hotspots): Scans all.ts,.tsx,.js, and.jsxfiles in your workspace and lists every hotspot sorted worst-first. - Quick Fixes (
Ctrl+.): Directly from any diagnostic, suppress intentional hotspots with// bigo-ignoreor jump into the Complexity Dashboard.
Settings & Commands
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
bigoAnalyzer.enabled |
boolean |
true |
Enable or disable inline complexity analysis. |
bigoAnalyzer.showCodeLens |
boolean |
true |
Display CodeLens complexity summaries above functions. |
bigoAnalyzer.showDecorations |
boolean |
true |
Highlight the worst bottleneck line in the active editor. |
bigoAnalyzer.hotspotThreshold |
string |
"O(n²)" |
Minimum complexity flagged as 🔥 (O(n log n), O(n²), O(2^n)). |
bigoAnalyzer.showDiagnostics |
boolean |
true |
Report hotspot functions in the VS Code Problems panel. |
bigoAnalyzer.diagnosticSeverity |
string |
"Information" |
Diagnostic severity (Hint, Information, Warning). |
bigoAnalyzer.preset |
string |
"recommended" |
Team rule preset (relaxed, recommended, strict). |
bigoAnalyzer.rules |
object |
{} |
Per-rule severity overrides (off, hint, info, warning). |
bigoAnalyzer.ignore |
string[] |
[] |
Glob patterns of files to skip from analysis. |
Commands
Big-O: Jump to Bottleneck(bigoAnalyzer.revealBottleneck) — Jumps to and selects the worst-case construct inside a function.Big-O: Toggle Complexity Annotations(bigoAnalyzer.toggleEnabled) — Toggles the extension on/off globally.Big-O: Open Complexity Dashboard(bigoAnalyzer.openDashboard) — Opens the interactive SVG Big-O growth chart and current-file breakdown.Big-O: Scan Workspace Hotspots(bigoAnalyzer.scanWorkspace) — Audits all JS/TS files in the workspace and lists hotspots worst-first.Big-O: Create Team Config (.bigorc.json)(bigoAnalyzer.initConfig) — Creates and opens a starter.bigorc.jsonin your workspace root.Big-O: Open Getting Started Walkthrough(bigoAnalyzer.openWalkthrough) — Opens the built-in 4-step interactive walkthrough inside VS Code / Antigravity IDE.
Team Rule Sets (.bigorc.json & Presets)
Commit a .bigorc.json file in your repository root (or run Big-O: Create Team Config (.bigorc.json)) to enforce shared Big-O standards across your team—edits reload automatically on save.
{
"preset": "recommended",
"rules": {
"noSpreadInLoop": "warning",
"noShiftInLoop": "warning",
"noHeavyLoopOp": "info",
"noRegexInLoop": "info",
"noNestedArrayLookup": "info",
"noSortInLoop": "info"
},
"ignore": ["**/*.test.ts", "scripts/**"]
}
| Preset | Default Threshold | Default Severity | Behavior |
|---|---|---|---|
relaxed |
O(n²) |
Hint |
Flags quadratic loops, spreads, .shift(), and nested lookups; turns off .sort(), JSON/Object.*, and RegExp rules. |
recommended |
O(n²) |
Information |
Balanced defaults with all 6 anti-pattern rules enabled at info. |
strict |
O(n log n) |
Warning |
Flags O(n log n)+ hotspots and elevates all 6 anti-pattern rules to warning. |
Supported rule keys: noSpreadInLoop, noShiftInLoop, noHeavyLoopOp, noRegexInLoop, noNestedArrayLookup, noSortInLoop (each accepts "off", "hint", "info", or "warning").
Publishing & Automated Releases (Zero Secrets / OIDC)
This repo includes ci.yml (runs on pushes/PRs to main) and publish.yml (automatically tests, packages, creates a GitHub Release, and publishes to both VS Code Marketplace and Open VSX on any v* tag using Trusted Publishing OIDC—no stored PAT secrets required).
Releasing a New Version
npm version patch && git push --follow-tags
Pushing the v* tag automatically triggers publish.yml to update VS Code Marketplace, Open VSX (Antigravity IDE), and GitHub Releases.
Local Development
npm install
npm test # Run pure AST unit tests (node --test)
npm run compile # Typecheck and bundle dist/extension.js
npm run package:vsix # Build production .vsix package
Press F5 in VS Code to launch the Extension Development Host with sample/demo.ts.
