Context Switch Time

I’m learning about CPU virtualization and the Limited Direct Execution model. Part of CPU virtualization is allowing multiple processes to share a CPU and run concurrently. A context switch occurs when the operating system pauses one process and resumes another, requiring the CPU to save and restore process state. This overhead can significantly impact system performance, so measuring it helps us understand the cost of multitasking. After the syscall time homework, I also got a task to measure how much a context switch costs1. The book mentions that LMbench uses the following approach to measure it: ...

September 22, 2025 · 3 min

How Long Does a System Call Take?

I’m learning about CPU virtualization and the Limited Direct Execution model. As part of that, I got some homework1 to measure how long a system call takes. The book suggests: Measuring the cost of a system call is relatively easy. For example, you could repeatedly call a simple system call (e.g., performing a 0-byte read), and time how long it takes; dividing the time by the number of iterations gives you an estimate of the cost of a system call. ...

September 20, 2025 · 2 min

Performance Issues with Large Data in window.history.state

TL;DR: Storing full collection data in window.history.state is expensive (serialization time, retained memory, and browser size limits). Prefer storing cursors/params and keep large data in an in-memory cache keyed by URL; use sessionStorage/IndexedDB if persistence is required. I’ve found an interesting issue with the Shopify Hydrogen component because it saves all nodes on a page in window.history.state as you can see in this line. For the particular website I am working with at the moment, the collection page has quite a bunch of data. When I tested, showing about 100 products on the page meant having ~8MB for the serialized version of the object using JSON.stringify. Deserialized structures also incur engine overhead (object headers, indices). The Pagination component from Shopify that we use does many things, but what I want to emphasize is that it saves the collection data in window.history.state: ...

September 18, 2025 · 4 min

My Bun Migration Story: From CI to Local Development

My Experience with Bun I’ve been using Bun for a while now. The first time I’ve heard about it I thought it was cool that it uses JavaScriptCore instead of V8 and that I could use it as a drop-in replacement for npm install. As a web developer working on Shopify Hydrogen apps, I ended up just staying with the project defaults, which meant npm. Moving CI to Bun However, as we added more steps to our CI, like additional lint rules, I noticed the pipeline slowed down significantly. In particular, I observed that our dependent steps spent substantial time on the installation phase. Due to that, a year or so ago I decided to experiment with Bun on our CI for all our steps, including deployment. ...

September 13, 2025 · 3 min