Takina · · 6 min read How to Break Up Long Tasks in JavaScript
Long tasks block the main thread for 50ms or more and make pages feel frozen. How to split them with yielding, scheduler.yield(), postTask, and workers.
Topic
157 posts tagged “Performance”.
Takina · · 6 min read Long tasks block the main thread for 50ms or more and make pages feel frozen. How to split them with yielding, scheduler.yield(), postTask, and workers.
The Lycoris Team · · 6 min read Copy-on-write shares data until someone modifies it, then copies only what changed. How CoW powers fork(), snapshots, containers, and immutable data.
Takina · · 5 min read Passive event listeners tell the browser a handler won't call preventDefault(), so scrolling starts at once. How { passive: true } works and when to use it.
The Lycoris Team · · 5 min read TCP congestion control decides how fast a sender transmits without overloading the network. Slow start, AIMD, CUBIC, and BBR explained.
The Lycoris Team · · 5 min read Head-of-line blocking is when one stalled item holds up everything queued behind it. How it affects HTTP/1.1, HTTP/2 over TCP, and how QUIC fixes it.
Chisato · · 5 min read Tail latency is the response time of your slowest requests, measured as p99 or p999. Why averages hide it, what causes it, and how to reduce it.
Takina · · 5 min read Code splitting breaks one large JavaScript bundle into smaller chunks loaded on demand. How bundlers do it, the main strategies, and the trade-offs.
Takina · · 5 min read Microtasks (promise callbacks) run before the next macrotask (timers, events). How the two queues are ordered, and why it matters for your code.
Takina · · 5 min read OffscreenCanvas lets you render canvas graphics off the main thread, in a web worker, so heavy drawing work stops blocking scrolling, input, and animation.
The Lycoris Team · · 5 min read The thundering herd problem hits when a cached value expires and every waiting request floods the backend at once. Here's why it happens and how to stop it.
Chisato · · 4 min read Thermal interface material fills microscopic gaps between a chip and its heatsink so heat can actually transfer to the cooler.
The Lycoris Team · · 4 min read PgBouncer sits between clients and Postgres, reusing a small pool of real connections. Session, transaction, and statement modes trade features for scale.
Chisato · · 4 min read Continuous batching lets an LLM server add and remove requests from a batch mid-generation, instead of waiting for a fixed group to finish together.
Chisato · · 4 min read Clock speed measures cycles per second; IPC measures work done per cycle. Real CPU performance is the product of both, not either one alone.
Chisato · · 4 min read Replication lag is the delay between a write on the primary database and its arrival on a replica. What causes it, how to measure it, and how to reduce it.
Takina · · 4 min read A variable font packs every weight, width, and style into a single file, controlled with CSS — cutting requests and enabling fluid typography.
Takina · · 3 min read A SharedWorker runs one script shared across every tab and window of the same origin — a single background thread they can all connect to and message.
Chisato · · 4 min read UMA gives every CPU core equal-latency memory access; NUMA gives each core faster access to its local memory bank. How the two architectures differ.
The Lycoris Team · · 5 min read ISR lets a static page be rebuilt in the background after deploy, on a timer or on demand, without a full site rebuild. How it works and its tradeoffs.
Takina · · 5 min read ResizeObserver watches an element's size; IntersectionObserver watches its visibility. Both replace scroll/resize listeners — here's when to use each.
Chisato · · 5 min read Overclocking runs a CPU, GPU, or memory beyond its rated clock speed for more performance, trading power, heat, and stability margin to get it.
The Lycoris Team · · 5 min read Floating-point numbers can't represent most decimals exactly in binary — that's why 0.1 + 0.2 gives 0.30000000000000004, and what IEEE 754 actually stores.
The Lycoris Team · · 4 min read Load testing measures how a system behaves under expected and peak traffic, revealing bottlenecks and capacity limits before real users do.
Takina · · 4 min read The Server-Timing HTTP header exposes backend performance metrics — database time, cache hits — directly in the browser's DevTools network panel.
Takina · · 5 min read The CSS contain property tells the browser an element's layout, paint, or size won't affect the rest of the page — unlocking safe, targeted rendering shortcuts.
Chisato · · 5 min read Clock gating and power gating both cut chip energy use by disabling idle circuit blocks, but one stops the clock while the other cuts power entirely.
Chisato · · 5 min read NVMe SSDs talk directly over PCIe for massive parallel throughput; SATA SSDs are bottlenecked by an interface built for spinning disks. Here's why it matters.
The Lycoris Team · · 5 min read A clustered index determines the physical row order on disk; a non-clustered index is a separate lookup structure. How they differ and when to use each.
Takina · · 4 min read WebTransport is a browser API for low-latency, bidirectional client-server messaging over HTTP/3. How it works and when to reach for it.
Chisato · · 4 min read A cold start is the extra latency a serverless function pays when a new execution environment must be provisioned before it can run. Causes and fixes.
Takina · · 4 min read setTimeout runs a callback once after a delay; setInterval repeats it on a fixed cadence — but drifts under load in ways setTimeout recursion avoids.
Takina · · 4 min read Node's cluster module forks whole processes to use every CPU core; worker_threads share memory inside one process. How to pick between them.
The Lycoris Team · · 5 min read Just-in-time (JIT) compilation translates code to native machine instructions while a program runs, trading startup time for peak execution speed.
Chisato · · 4 min read False sharing happens when threads on different cores write to unrelated variables that share one cache line, silently wrecking performance.
Takina · · 4 min read Stale-while-revalidate serves a cached response instantly while fetching a fresh one in the background, so no request waits on the network.
Chisato · · 4 min read Instruction pipelining overlaps a CPU's fetch, decode, and execute stages so multiple instructions are in flight at once. How it works.
Takina · · 4 min read JavaScript frees memory automatically by tracking reachability, not reference counts. How the mark-and-sweep algorithm works and what causes leaks anyway.
The Lycoris Team · · 4 min read The N+1 query problem fires one query per row instead of one query total, quietly turning a fast page into hundreds of round trips. How to spot and fix it.
Chisato · · 4 min read Neural network pruning removes redundant weights or neurons after training to shrink a model without retraining from scratch. How it works.
Takina · · 3 min read Reflow recalculates layout; repaint just redraws pixels. Why the difference matters for animation performance and how to avoid triggering reflow.
Takina · · 4 min read requestAnimationFrame schedules work right before the next repaint; requestIdleCallback runs only when the browser is otherwise idle. When to use each one.
The Lycoris Team · · 5 min read Hash joins, nested loop joins, and merge joins are the three ways a database executes a JOIN — here's when the query planner picks each one.
Takina · · 4 min read ArrayBuffer allocates raw binary memory; typed arrays like Uint8Array give it a numeric type and view. How JavaScript handles binary data directly.
Chisato · · 4 min read HBM stacks DRAM vertically next to the chip for extreme bandwidth per watt; GDDR spreads fast chips around the board. How the two approaches differ.
Takina · · 4 min read INP measures how long a page takes to visually respond to a click, tap, or keypress. What it counts, how it's scored, and how to bring it down.
Chisato · · 4 min read Memory-mapped I/O maps device registers into the CPU's address space, letting hardware be read and written with ordinary load and store instructions.
Takina · · 4 min read The bfcache stores a full, running snapshot of a page in memory so back and forward navigation is instant instead of a fresh load. How it works.
The Lycoris Team · · 4 min read A composite index spans multiple columns in a fixed order, speeding up queries that filter or sort on that combination. How column order changes everything.
Takina · · 4 min read Node.js worker threads run JavaScript on real OS threads in parallel, letting CPU-heavy work run without blocking the event loop.
Chisato · · 5 min read A memory controller is the circuit that manages every read and write between the CPU and main memory, setting the ceiling on bandwidth and latency.
Takina · · 3 min read SharedArrayBuffer lets JS threads share raw memory; Atomics provides race-free operations on it. How true multi-threaded data sharing works in JS.
Chisato · · 4 min read DDR5 raises transfer rates, splits each module into two independent sub-channels, and moves voltage regulation onto the module itself. Here's what that buys you.
The Lycoris Team · · 4 min read Cache-aside puts the application in charge of loading cache misses; read-through delegates that job to the cache itself. How each pattern works.
The Lycoris Team · · 4 min read Amdahl's Law says a program's speedup from parallelizing is capped by the fraction that must stay sequential — no matter how many cores you add.
Chisato · · 5 min read Memory channel configuration multiplies bandwidth between RAM and the CPU. How single-, dual-, and quad-channel setups differ, and why slot order matters.
Chisato · · 4 min read Edge functions run application code on servers near the visitor instead of a single origin region, cutting latency for auth, redirects, and personalization.
The Lycoris Team · · 4 min read A bitmap index uses a bit array per distinct value to speed up queries on low-cardinality columns, and combines multiple filters with fast bitwise AND/OR.
Takina · · 4 min read The Page Visibility API tells JavaScript when a tab is hidden or visible, so you can pause polling, animations, and timers the user can't see.
Takina · · 4 min read The Beacon API lets a page send one last async request as it unloads, without blocking navigation or racing the browser's page teardown.
The Lycoris Team · · 4 min read Write amplification is when a system writes more data physically than the logical write requested, wearing out storage faster and hurting throughput.
The Lycoris Team · · 4 min read Redis is in-memory, so RDB snapshots and the AOF log are how it survives a restart — each trades durability against performance differently.
Chisato · · 4 min read Virtual memory gives every process its own private address space, mapped to physical RAM by the OS and CPU — enabling isolation, swapping, and overcommit.
Takina · · 3 min read fetchpriority lets you tell the browser which resources matter most, overriding its default heuristics to load critical assets sooner.
The Lycoris Team · · 6 min read A step-by-step guide to running EXPLAIN ANALYZE in PostgreSQL and reading the query plan it returns — node types, costs, and where the real time went.
The Lycoris Team · · 5 min read Backpressure is how a slow consumer signals a fast producer to hold off, preventing memory exhaustion in streams, queues, and network protocols.
The Lycoris Team · · 5 min read Little's Law relates the number of requests in a system, their arrival rate, and how long each one takes — a simple formula for sizing capacity.
The Lycoris Team · · 5 min read LRU evicts whatever hasn't been used in the longest time; LFU evicts whatever has been used the fewest times. How each policy behaves and when to pick it.
The Lycoris Team · · 5 min read Postgres offers several index types beyond the default B-tree. When GIN and GiST outperform it for arrays, JSONB, full-text search, and ranges.
Takina · · 4 min read requestIdleCallback runs low-priority JavaScript when the browser is idle, without blocking rendering, input, or the main thread.
Takina · · 4 min read HTTP range requests let a client ask for just part of a resource, enabling video seeking, resumable downloads, and partial file fetches over HTTP.
Takina · · 4 min read JavaScript's dynamic import() loads a module on demand and returns a promise, letting you split bundles and defer code until it's actually needed.
Chisato · · 5 min read Memory interleaving spreads consecutive addresses across multiple memory banks so the system can access them in parallel instead of one at a time.
The Lycoris Team · · 5 min read A covering index holds every column a query needs, letting the database answer from the index alone without a lookup back to the table.
Takina · · 5 min read A JavaScript memory leak happens when a reference outlives its usefulness and the garbage collector can't reclaim it. Common causes and how to find them.
Chisato · · 5 min read Endianness decides whether a multi-byte number's most or least significant byte is stored first in memory. Why it matters and how to spot it.
Chisato · · 4 min read Speculative execution lets a CPU guess ahead and run instructions before it knows they're needed, buying speed at the cost of the timing side channels behind Spectre and Meltdown.
Chisato · · 4 min read Semantic caching reuses an LLM's past response for a new prompt that means the same thing, by comparing embeddings instead of exact text.
Takina · · 5 min read Gzip and Brotli both shrink HTTP responses before they hit the wire. How each algorithm works, and why Brotli usually compresses text tighter.
The Lycoris Team · · 5 min read Write-through writes to cache and store together, write-back delays the store write, write-around skips the cache on writes entirely. When to use each.
The Lycoris Team · · 4 min read Amortized analysis measures the average cost of an operation over a sequence of calls, not its worst case. How dynamic array resizing gets O(1) amortized inserts.
Chisato · · 4 min read A systolic array is a grid of processing elements that pass data to their neighbors in rhythm, built to accelerate matrix multiplication in AI chips like TPUs.
Takina · · 5 min read The CSS will-change property hints the browser to prepare an element for an upcoming change, moving it to its own compositor layer. When to use it and when not to.
Chisato · · 4 min read SIMD lets a CPU apply one instruction to multiple data points at once. How vectorization works, why compilers auto-vectorize loops, and its limits.
Chisato · · 4 min read DMA lets peripherals move data to and from memory without the CPU copying every byte, freeing the processor to do other work during transfers.
Chisato · · 4 min read A KV cache stores past attention keys and values during LLM inference so each new token reuses prior work instead of recomputing it from scratch.
Chisato · · 4 min read Thermal throttling automatically reduces a chip's clock speed when it gets too hot, trading performance for safety. How it works and how to spot it.
Takina · · 4 min read The Intersection Observer API tells you when an element enters or leaves the viewport, without scroll-event polling. How it works and where to use it.
Takina · · 4 min read WebP, AVIF, and JPEG trade off compression, browser support, and encode speed differently. Which format to use where, and how to serve fallbacks safely.
Takina · · 4 min read The CSS font-display property controls whether text waits for a web font or renders in a fallback first. Here's how swap, block, and optional differ.
Takina · · 4 min read HTTP/2 fixed request multiplexing but stayed on TCP; HTTP/3 moves to QUIC over UDP to kill head-of-line blocking at the transport layer. The real differences.
Takina · · 4 min read Responsive images use srcset and sizes to let the browser pick the right file for each screen, cutting wasted bytes without extra JavaScript.
Chisato · · 4 min read TDP is the amount of heat a cooling system must dissipate for a chip, not a hard limit on its power draw. Why TDP and actual power draw often diverge.
Takina · · 4 min read content-visibility lets the browser skip layout, style, and paint for off-screen content, cutting rendering cost on long pages without JavaScript.
Takina · · 4 min read requestAnimationFrame schedules a callback right before the browser repaints, syncing JavaScript animation to the display's refresh rate. How it works.
Takina · · 4 min read The Speculation Rules API lets browsers prerender pages before a click, making navigation feel instant. How it works and how it differs from prefetch.
Takina · · 4 min read Progressive enhancement builds a working page with HTML first, then layers CSS and JavaScript on top — so a slow network or failed script never breaks the core experience.
Chisato · · 4 min read NUMA gives each CPU its own local memory bank, so access speed depends on which processor is asking. How NUMA nodes and remote access latency work.
Chisato · · 5 min read RAID combines multiple drives into one logical unit for redundancy, speed, or both. How RAID 0, 1, 5, 6, and 10 trade off capacity, speed, and safety.
Chisato · · 4 min read PCIe (PCI Express) is the high-speed serial bus connecting GPUs, SSDs, and network cards to a CPU. How lanes, generations, and bandwidth work.
Chisato · · 4 min read SSDs store data in flash memory chips with no moving parts; HDDs use spinning magnetic platters. How that difference plays out in speed, cost, and durability.
Chisato · · 4 min read Bandwidth measures how much data memory moves per second; latency measures how long one access takes. Why chips need both, not just one.
Takina · · 4 min read Web workers run scripts off the main thread for parallel computation. Service workers intercept network requests for offline and caching. How they differ.
The Lycoris Team · · 4 min read A quantum computer uses qubits in superposition and entanglement to explore many possible states at once, rather than one bit value at a time.
Chisato · · 4 min read ECC memory detects and corrects single-bit errors in RAM automatically, using extra parity bits — critical for servers where silent corruption is costly.
Chisato · · 4 min read DDR and GDDR are both DRAM, but optimized for opposite goals: DDR minimizes latency for CPUs, GDDR maximizes bandwidth for GPUs. Here's how they diverge.
Takina · · 3 min read Lazy loading defers offscreen images until they near the viewport. Comparing the native loading attribute against Intersection Observer-based approaches.
Chisato · · 4 min read A DPU is a specialized chip that offloads networking, storage, and security tasks from the CPU. How data processing units fit alongside CPUs and GPUs.
Chisato · · 4 min read A process node like '5nm' or '3nm' names a chipmaker's manufacturing generation, not a literal measurement anymore. Here's what the number means.
Takina · · 5 min read Cache-Control and ETag are the two headers that control HTTP caching — how long a response stays fresh and how to revalidate it cheaply, explained.
Takina · · 4 min read Resource hints like preload, prefetch, and preconnect tell the browser what to fetch early. Here's how each one works and when to reach for it.
Chisato · · 5 min read RISC and CISC are two philosophies for CPU instruction sets — simple fixed-length instructions versus fewer, complex ones. How they differ and why.
Takina · · 4 min read Astro's islands architecture ships static HTML by default and hydrates only the interactive components that need JavaScript. Here's how it works.
Chisato · · 4 min read A system on chip packs a CPU, GPU, memory controller, and other components onto one die — the design behind phones, laptops, and most modern chips.
Chisato · · 5 min read ARM and x86 are the two dominant CPU instruction set architectures — how RISC vs CISC design differs and why it affects power and performance.
Takina · · 4 min read AbortController lets JavaScript cancel an in-flight fetch or async task on demand, preventing stale responses from overwriting newer state.
The Lycoris Team · · 5 min read The N+1 query problem turns one database request into hundreds by issuing a separate query per row. Here's how to spot it and fix it.
The Lycoris Team · · 5 min read Connection pooling reuses a fixed set of open database connections instead of opening a new one per request. How pools work and why they prevent overload.
Chisato · · 4 min read SRAM is fast, expensive, six-transistor memory used for CPU caches; DRAM is slower, cheaper, one-transistor memory used for main system memory.
The Lycoris Team · · 4 min read A materialized view stores a query's result as physical data instead of recomputing it on every read. How it differs from a view, and when to use one.
Chisato · · 4 min read Speculative decoding speeds up LLM text generation by having a small draft model guess tokens the large model verifies in one pass. Here's how it works.
Takina · · 4 min read CSS scroll-driven animations tie keyframes to scroll position instead of a clock, running smoothly off the main thread. Here's how the timeline model works.
Takina · · 4 min read SSR renders pages per request; SSG renders them at build time. How the tradeoff affects speed, freshness, and hosting cost — and how to pick.
Takina · · 4 min read The critical rendering path is the sequence a browser follows from HTML bytes to painted pixels — DOM, CSSOM, render tree, layout, paint.
Chisato · · 4 min read An FPGA is a chip whose logic circuits can be reconfigured after manufacturing, sitting between fixed-function ASICs and general-purpose CPUs in flexibility.
Takina · · 4 min read A PWA is a website built to behave like a native app — installable, offline-capable, and fast — using standard web technologies, not app-store code.
Chisato · · 5 min read A chiplet is a small, self-contained die that's packaged together with others to form one chip. How chiplets work and why the industry moved to them.
Chisato · · 4 min read Edge computing runs code and stores data near where it's generated instead of in a centralized data center, cutting latency and bandwidth costs.
Takina · · 4 min read A web worker runs JavaScript on a background thread, freeing the main thread to keep the UI responsive. How workers communicate and when to use one.
The Lycoris Team · · 4 min read Database replication keeps copies of data on multiple servers for redundancy and read scaling, at the cost of consistency and lag tradeoffs.
Chisato · · 4 min read CPUs excel at sequential logic, GPUs at parallel math, and TPUs at the specific matrix operations behind neural networks. Here's how they compare.
Takina · · 4 min read Tree shaking removes unused exports from a JavaScript bundle at build time, shrinking file size by relying on ES module static structure.
Takina · · 4 min read A service worker is a script that runs separately from your page, intercepting network requests to enable offline access, caching, and push notifications.
Takina · · 5 min read Debounce and throttle both tame rapid-fire events, but differently — debounce waits for a pause, throttle enforces a steady rate. When to use each.
The Lycoris Team · · 5 min read Big O notation describes how an algorithm's time or memory grows as input grows. The common classes, what they mean, and how to reason about them.
The Lycoris Team · · 4 min read A database index is a sorted data structure that lets the engine find rows without scanning the whole table. How indexes work, and when they help or hurt.
Chisato · · 4 min read Qualcomm's second-generation laptop chip jumps to 18 cores, 5 GHz, and an 80 TOPS NPU. What changed from the Snapdragon X Elite — and whether it matters.
Chisato · · 6 min read Caching keeps a copy of expensive data somewhere faster. How cache-aside, write-through, and TTLs work — and why invalidation is the hard part.
Chisato · · 4 min read An NPU is a processor built for one job: running AI models fast at very low power. What TOPS numbers actually mean and why every new laptop ships with one.
Chisato · · 6 min read Google TurboQuant compresses AI model memory ~6x with no accuracy loss or retraining, and speeds attention up to 8x. How it works and what it means for HBM.
Chisato · · 5 min read Redis and Memcached are both in-memory caches, but they differ on data types, persistence, and threading. How to choose — and when each one wins.
Takina · · 4 min read Container queries let components respond to the space they're given, not the viewport. Here's how they work and when to reach for them.
Chisato · · 4 min read Quantization reduces the numeric precision of a model's weights — e.g. FP16 to INT8 or INT4 — to shrink memory use and speed up inference with minimal accuracy loss.
Takina · · 5 min read Static sites don't need a search server. Learn how Pagefind indexes your HTML at build time and adds fast, client-side full-text search for free.
The Lycoris Team · · 7 min read A load balancer distributes traffic across servers to prevent overload and downtime. Layer 4 vs Layer 7, routing algorithms, health checks, and TLS.
Chisato · · 3 min read High-Bandwidth Memory stacks DRAM dies vertically beside the processor, delivering far more bandwidth than DDR5 or GDDR — and AI hardware depends on it.
Takina · · 5 min read WebAssembly lets near-native code run in the browser and beyond. It's no longer experimental — here's where it's actually being used and why it matters.
Chisato · · 2 min read AMD's Instinct MI400 brings 432GB of HBM4 and a full-rack Helios system to challenge NVIDIA in 2026. Here's what the MI455X packs and why it matters.
Takina · · 4 min read Hydration is how JavaScript wakes up server-rendered HTML so static markup becomes interactive. The cost, the tradeoffs, and the modern alternatives.
Chisato · · 4 min read Prompt caching can slash LLM API costs and latency by reusing repeated context. Here's how it works, what to cache, and the silent mistakes that break it.
Chisato · · 6 min read Redis is an in-memory key-value store used as a cache, database, and message broker. How it works, why it's sub-millisecond fast, and when to use it.
Chisato · · 2 min read NVIDIA unveiled Vera Rubin — a platform of six new chips designed to work as a single AI supercomputer — while its Vera CPU enters full production. What's coming.
Takina · · 4 min read HTTP/3 runs over QUIC instead of TCP, cutting head-of-line blocking and speeding up connections with built-in TLS 1.3. What changed and why it matters.
Takina · · 5 min read Core Web Vitals affect both user experience and search ranking. Here's what LCP, INP, and CLS actually measure and the highest-impact ways to fix each one.
Chisato · · 3 min read A CDN caches your content on servers around the world so users load it from nearby. How CDNs cut latency, protect origins, and power dynamic apps.
Chisato · · 3 min read A small language model runs cheaply on-device, trading some capability for speed, privacy, and cost. When SLMs beat frontier models and how they're built.
Takina · · 4 min read WebGPU is far more than a WebGL replacement. It exposes compute shaders, maps to modern GPU APIs, and enables in-browser ML inference.
Takina · · 4 min read Server-Sent Events stream real-time updates over a single HTTP connection. How SSE works, when to use it, and how it compares to WebSockets.