let has not been shown to run seven times slower than var in V8 as a general rule. The available V8 sources explain how captured variables can live in heap-allocated closure contexts, how optimizations can eliminate some context allocations, and how garbage collection uses heuristics. They do not establish that these mechanisms cause a 7× let-versus-var slowdown.
Where did the “7× slower” claim come from?
A historical V8 issue does report an up-to-7× difference, but it concerns global-variable access in a browser benchmark—not a comparison of let and var. The issue discussion attributes the observed slowdown to global accesses. It dates to 2011, so it also cannot establish how modern V8 behaves. V8 issue 1704
As an Amazon Associate I earn from qualifying purchases.
That number should not be repeated as a general JavaScript performance fact. The reviewed sources contain no verified benchmark showing let to be 7× slower than var, and no evidence tying such a result to closure contexts or a garbage-collection threshold.
What closure contexts do—and do not—show
When an inner function refers to a variable from an outer function, that variable may need to remain accessible after the outer function returns. V8 describes storing such captured values in a heap-allocated context, which a function closure can refer to along with its code. This is about keeping captured variables available for the closure’s lifetime; it does not mean every let declaration incurs a heap allocation or that let is inherently slower than var. V8: “Blazingly fast parsing, part 2: lazy parsing”
#1 Best Overall
Some context allocations can be optimized away
V8’s v7.1 release article describes an escape-analysis optimization that eliminated a local function-context allocation in some cases. The article reported improvements of up to 40% in some cases. That is a version- and code-specific optimization report, not a let-versus-var result or a promise of the same gain in current V8. V8 v7.1 release
Can garbage collection explain a large timing difference?
Garbage collection can affect runtime, but the cited V8 explanation describes generational collection and a heuristically derived limit for major collection based on live old-generation objects. It does not give one fixed threshold that explains a sevenfold slowdown. The article is historical, so its details should not be treated as a guarantee of current V8 thresholds. V8: “Getting garbage collection for free”
Rank #2
A separate V8 article reported that one closure-creation and scavenge microbenchmark spent around 98% of its execution time in garbage collection before a lazy-unlinking data-structure change. That observation belongs to that particular benchmark, which created many functions and triggered many scavenges; it is not evidence that let causes heavy GC or runs more slowly than var. V8: “An internship on laziness: lazy unlinking of deoptimized functions”
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →What a useful `let`-versus-`var` benchmark must control
A timing result alone cannot identify closure allocation or GC as its cause. To test whether declaration kind matters in a specific workload, keep the work and semantics equivalent, then report both elapsed time and evidence about allocation and collection.
- Runtime and build: identify the V8 version and the embedding runtime, along with the hardware used.
- Equivalent code: hold the inputs, operation count, scope, closure shape, captured variables, and closure lifetime constant. Changing declaration kind should not also change the work performed.
- Optimization state: document warm-up and the optimization tier or setup, so the comparison is not between differently optimized code paths.
- Memory and collection: account for memory pressure and GC settings, and collect allocation and GC observations alongside elapsed time.
Without those details, a benchmark may show a timing difference but cannot establish that lexical bindings, closure contexts, or a GC threshold caused it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Do not confuse two meanings of “context”
In discussions of closures, a context holds values captured from an outer lexical scope. V8’s embedding documentation also uses “context” for an execution environment used to isolate applications. That embedding term is not the same thing as a lexical closure context, and the documentation does not support treating the two as interchangeable. V8 embedding documentation
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




