BitlystBitlyst
PostsSeriesTopicsAbout

Bitlyst

Short, diagram-first posts on JavaScript, React & Next.js. Follow via RSS or the newsletter.

© 2026 Mohsen Fallahnejad

PostsSeriesTopicsLinksAboutSync devicesRSSGitHubX
← All topics

#performance

21 posts

Packed vs Holey Arrays in V8: Why new Array(n) Makes Spread 4x Slower

V8 labels every array by what it holds and whether it may have gaps. Labels only get more general, and holey arrays take slower paths.

Nov 11, 20268 min read

turbopackRustReactCompiler: Running the React Compiler in Rust Inside Next.js

The React Compiler normally runs through Babel in Node.js. Next.js can run a Rust version inside Turbopack instead. Learn what that changes and what it saves.

Nov 10, 20264 min read

What Is Turbopack? How Next.js's Rust Bundler Avoids Doing Work Twice

Turbopack is the Rust bundler inside Next.js. Learn the one idea behind its speed, remembering every small step, and when you'll actually feel it.

Nov 10, 20265 min read

V8 Garbage Collection: Why Middle-Aged Objects Are the Expensive Ones

How V8's generational garbage collector works: scavenges cost per survivor, short-lived objects are nearly free, and pretenuring makes long-lived ones cheap.

Nov 6, 20267 min read

CPU Cache and JavaScript: Why Sorting an Array Can Make Loops 7x Slower

How memory locality and CPU cache misses affect JavaScript: why array order changes loop speed for large arrays of objects, and when typed arrays help.

Nov 6, 20265 min read

Sliced Strings in V8: How a 20-Character ID Keeps 1 MB Alive

Why slice() in V8 can keep a huge parent string alive, how sliced strings cause memory leaks in Node.js, and how to copy a string to release it.

Nov 6, 20265 min read

Hidden Classes in V8: Why Object Shape Changes Speed

How V8 hidden classes and inline caches work, why property reads get slower past four object shapes, and how to keep hot code monomorphic.

Nov 6, 20266 min read

Layout Thrashing: Why Reading offsetWidth in a Loop Freezes the Page

What layout thrashing and forced reflow are, why reading offsetWidth after a style change is slow, and how batching reads and writes fixes it.

Nov 6, 20265 min read

Scrolling My Blog Index Prefetched All 51 Posts. One Config Line Cut It to 90 kB.

What a long list of Next.js <Link>s really costs in prefetch requests, measured on this blog, and how partialPrefetching shares one App Shell per route instead.

Nov 3, 20264 min read

One Line in My Root Layout Turned 158 Static Pages Into 0

Reading a cookie with cookies() in the Next.js root layout opts every route out of static rendering. What it cost this blog, measured, and how to fix a theme flash without it.

Nov 1, 20267 min read

I Optimized a Button From O(n) to O(1). The Speed Didn't Matter.

A bug report, a route map, and three rounds of making it faster — a story about what Big O really measures, why constants win at small n, and why the best algorithm is sometimes deleting the question.

Oct 31, 202610 min read

Debounce vs Throttle — One Sentence to Remember Forever

Two patterns for taming fast events: debounce waits for silence, throttle limits how often. With examples, code, and interview answers.

Jul 8, 20264 min read

React memo vs useMemo vs useCallback — When to Use Which

Three React APIs that all say 'memoize' — but they do different things. Clear explanations, examples, and a cheatsheet.

Jun 28, 20263 min read

CDN Explained: What It Is, How It Works, and How to Use It in Next.js

A CDN speeds up your app by serving assets from servers close to your users. Here's how it works and how Next.js takes advantage of it.

Jun 20, 20263 min read

Are TypeScript Enums a Good Idea? (Bundle Size & Runtime)

A practical guide to TypeScript enums, their runtime cost, and better alternatives for modern frontend apps.

Dec 30, 20253 min read

Web Workers Explained for Frontend Developers

How Web Workers work, why they matter, and when to use them to achieve real parallelism in frontend apps.

Dec 30, 20253 min read

useDeferredValue Explained: Keeping React UIs Responsive

How useDeferredValue works under the hood, when to use it, and how it differs from useTransition.

Dec 12, 20251 min read

useTransition Explained: Make React Feel Instant

How useTransition works under the hood, when to use it, and how it differs from useDeferredValue.

Dec 12, 20253 min read

Prefetching in Next.js Links Explained

How Next.js prefetch works in <Link>, why it makes navigation fast, and when to disable it.

Oct 4, 20252 min read

Next.js App Router Caching — Cheat Sheet

A compressed reference of Next.js caching layers and controls (App Router).

Sep 20, 20252 min read

When Should You Use Dynamic Import in React/Next.js? (With Performance Comparison)

A practical guide to dynamic imports with real-world examples and a before/after bundle-size comparison using next-bundle-analyzer.

Sep 17, 20253 min read

Related topics

#nextjs#javascript#react#v8#app-router#frontend#caching#hooks