Top 30 Performance Interview Questions and Answers
30 multiple-choice questions on Performance, drawn from 30 bites out of the 508 tagged Performance on Tezvyn. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
Which change to Vue's template parser in 3.4 is primarily responsible for its 2× speed improvement?
Show the answer
Answer: b · It replaced recursive descent and heavy regex with a single-pass state-machine tokenizer
The card states the parser was rewritten from a recursive descent approach relying on heavy regex to a state-machine tokenizer based on htmlparser2 that iterates only once. Option A is tempting because it mentions htmlparser2, but the old regex-based tokenizer was fully replaced, not retained.
Read the full bite: Vue 3.4 Cuts Build Times 44%, Stabilizes defineModel
Question 2 of 30
For which file is //# allFunctionsCalledOnLoad the most appropriate optimization?
Show the answer
Answer: c · A core entry-point bundle whose functions execute during initial page load
The hint is designed for known startup files so V8 can compile them in the background during network load. Using it on all scripts (A) or on non-startup files (A, D) wastes CPU and memory without improving startup time.
Read the full bite: Chrome 136 cuts JS startup 630ms with compile hints
Question 3 of 30
What condition forces V8's JSON.stringify to abandon its new side-effect-free fast path and use the slower recursive serializer?
Show the answer
Answer: a · One of the properties defines a custom toJSON method
Custom toJSON methods execute user code during serialization, violating the side-effect-free guarantee required for the fast path. Deep nesting is actually improved by the iterative fast path, while Unicode strings and null-prototype objects do not inherently trigger the slower recursive serializer.
Read the full bite: V8 doubles JSON.stringify speed with side-effect-free fast path
Question 4 of 30
Why does WasmGC benefit significantly from speculative inlining while traditional Wasm 1.0 modules generally do not?
Show the answer
Answer: c · WasmGC features like virtual methods and subtyping produce indirect call targets that static analysis cannot predict, unlike statically structured Wasm 1.0.
WasmGC's higher-level constructs such as virtual methods and subtyping create opaque indirect call sites that defeat static analysis, making runtime feedback and speculative inlining essential. Option D reverses the actual relationship: Wasm 1.0 works well with ahead-of-time optimization precisely because it exposes sufficient static structure, not because it lacks it.
Read the full bite: Chrome M137 Ships Speculative Deopts and Inlining for Wasm
Question 5 of 30
An Angular app suffers from both excessive backend requests during username checks and bloated bundles from legacy ngIf/ngFor usage. Which paired approach best resolves both issues?
Show the answer
Answer: a · Debounce async validators in Signal Forms and migrate structural directives to Control Flow syntax
The correct paired approach is debouncing Signal Forms async validators to stop redundant backend calls and migrating legacy structural directives to Control Flow syntax for bundle and runtime gains. The most tempting distractor suggests using only synchronous validators and standalone components, but synchronous validators cannot check username availability against a backend, and standalone components do not replace legacy ngIf or ngFor directives.
Read the full bite: Angular 21.1 ships with Signal Forms debounce patterns
Question 6 of 30
When using Vue 3.5's stable reactive props destructure, what must you do to keep a destructured prop reactive when passing it to watch or a composable?
Show the answer
Answer: d · Wrap the variable in a getter function
Vue 3.5 requires wrapping destructured props in getters when passing them to watch or composables to preserve reactivity. Passing them directly severs the reactive link, and withDefaults is the old boilerplate this feature replaces.
Read the full bite: Vue 3.5 cuts reactivity memory 56%, adds lazy hydration
Question 7 of 30
Why does a 200ms synchronous data mapping on a React Native screen freeze interactive components like TouchableOpacity?
Show the answer
Answer: b · It monopolizes the JavaScript thread, so batched native updates and queued touch events cannot be processed.
The correct answer recognizes that the JavaScript thread is blocked, preventing batched native updates and touch events from being handled. Option A is tempting because it confuses the JavaScript thread with the native UI main thread, which is the exact misconception the card highlights.
Read the full bite: UI unresponsive during large data processing on main thread
Question 8 of 30
How does Svelte's compiler-first design most directly improve the end-user experience compared to virtual DOM frameworks?
Show the answer
Answer: a · It shifts work to build time, producing smaller bundles and less browser CPU work for faster page loads.
Svelte's compiler generates imperative vanilla JavaScript at build time, which shrinks bundles and eliminates virtual DOM diffing overhead for end users. Option D describes a developer experience benefit, not a user-facing performance improvement.
Read the full bite: What is the primary end-user benefit of Svelte's compiler-first approach?
Question 9 of 30
What is the primary effect of enabling inline requires in a React Native app?
Show the answer
Answer: a · It defers a module's evaluation until the first time it is actually used
Inline requires transform top-level imports so a module is evaluated lazily on first use, cutting startup work. It does not compile to machine code (that is closer to Hermes bytecode) nor perform tree shaking, which is a separate bundler concern.
Question 10 of 30
Why does wrapping a heavy synchronous computation in an async function fail to keep a Node server responsive?
Show the answer
Answer: a · The computation is still synchronous and never yields the single JS thread
async/await only helps when there is an awaited asynchronous boundary; a synchronous CPU loop still occupies the single thread, blocking the event loop. Worker Threads provide real parallelism.
Read the full bite: Offloading CPU-bound work with Worker Threads
Question 11 of 30
Why does indexing a Swift String by an integer like myString[5] not compile, unlike in many other languages?
Show the answer
Answer: c · Characters are variable-width grapheme clusters, so an integer offset cannot give O(1) or unambiguous access
Swift Characters are extended grapheme clusters of varying byte length, so an integer offset is neither constant-time nor meaningful, which is why String.Index is opaque. Immutability is unrelated, and String.Index is not an Int alias.
Read the full bite: Why can't you subscript a Swift String with an Int?
Question 12 of 30
Which statement best captures the mechanical cost of maintaining multiple indexes on a write-heavy table?
Show the answer
Answer: c · Every table write typically triggers random I/O to update each index's B-Tree, plus node splits and log overhead
The card explains that every write likely updates every index, causing extra random I/O, node splits, and WAL overhead. Option B reflects the common misconception that binary search trees are the classic disk structure, while D confuses hash indexes with the standard B-Tree approach.
Read the full bite: Explain database indexes, the classic data structure, and write-heavy trade-offs
Question 13 of 30
Why can defining styles with StyleSheet.create be preferable to inline literal objects in a long list?
Show the answer
Answer: c · It reuses a stable object reference across renders instead of allocating a new object each time
StyleSheet styles are created once and referenced by key, giving stable references that avoid per-render allocations. React Native has no CSS cascade, and unit handling is not what StyleSheet.create provides.
Question 14 of 30
What is the fundamental mechanism by which Hermes improves React Native app startup performance?
Show the answer
Answer: d · It performs Ahead-Of-Time (AOT) compilation of JavaScript into optimized bytecode during the app's build phase.
Hermes is an Ahead-Of-Time (AOT) focused engine that pre-compiles JavaScript into optimized bytecode during the build process, reducing the work the device has to do at startup. While it contributes to a smaller app size, its primary mechanism for faster startup is not tree-shaking or JIT compilation.
Read the full bite: Hermes: The JS Engine for Faster React Native Apps
Question 15 of 30
What is the primary benefit of splitting a CPU-intensive synchronous operation into smaller pieces using setTimeout(fn, 0)?
Show the answer
Answer: b · To allow the browser to process UI updates and user input between task segments.
The card states that splitting work with setTimeout(fn, 0) allows yielding control back to the event loop, enabling the browser to process user input and render updates, keeping the UI alive. Option A is incorrect because this technique adds overhead and does not necessarily speed up the overall execution time; its purpose is responsiveness, not raw speed.
Read the full bite: JavaScript's Event Loop: Macrotasks & Microtasks
Question 16 of 30
What is the fundamental problem Node.js streams are designed to solve for data handling?
Show the answer
Answer: a · Processing large datasets without exhausting system memory.
The card states streams were created to 'process data piece by piece, keeping memory usage low and constant regardless of the total data size' because loading large files entirely into memory is inefficient or impossible. While streams can simplify I/O (option D), their core purpose is memory efficiency for large data, and they are not ideal for random access (option C).
Read the full bite: Node.js Streams: Processing Data in Chunks, Not Blobs
Question 17 of 30
Why can using array indices as keys cause state pollution when a list is reordered?
Show the answer
Answer: d · React relies on keys to identify elements across renders; indices make React match DOM nodes to the wrong data, preserving state for the wrong item.
Keys provide sibling-scoped identity, not just a performance shortcut; when indices are reused after reordering, React incorrectly associates the old DOM node and its state with new data. Option A is wrong because keys fundamentally determine state preservation, so unstable keys create correctness bugs rather than merely slower reconciliation.
Read the full bite: How does React use keys in reconciliation? When do keys cause bugs?
Question 18 of 30
Why must a Kotlin function be declared `inline` to use a `reified` type parameter?
Show the answer
Answer: d · Because inlining moves the function's bytecode to the call site, where the compiler can access the concrete type argument.
The `reified` keyword needs to know the actual type at runtime, which is normally erased by the JVM. The `inline` keyword enables this by copying the function's code to the call site, where the compiler knows the concrete type (e.g., `String`) and can substitute it directly into the bytecode. Option C is incorrect because `inline` doesn't prevent type erasure in general; it provides a clever workaround for a specific call.
Read the full bite: Explain `inline` and `reified` in Kotlin
Question 19 of 30
For which scenario would Python's async/await typically NOT provide a performance benefit?
Show the answer
Answer: b · Processing a large dataset with intensive numerical calculations.
Async/await is designed for I/O-bound tasks where the program spends time waiting, allowing other tasks to run during these waits. CPU-bound tasks, like intensive numerical calculations, will block the single event loop, preventing any other tasks from progressing and thus negating the benefits of concurrency.
Read the full bite: Python's async/await: Concurrent, Not Parallel
Question 20 of 30
An endpoint fires 1 query for a list and then one extra query per item to load a relation. Which fix most directly reduces the number of round trips?
Show the answer
Answer: c · Eager-load the relation with a JOIN or single batched IN query
Eager loading collapses the per-item queries into one or two statements, attacking the round-trip count itself. Caching only masks the volume and adds invalidation work without removing the structural N+1 pattern.
Read the full bite: Diagnosing and fixing the N+1 query problem
Question 21 of 30
What is the main performance trade-off introduced by adding a database index?
Show the answer
Answer: d · It speeds up data retrieval but slows down data modification operations.
The card explicitly states that indexes speed up data retrieval but add overhead to INSERT, UPDATE, and DELETE operations, as the index structure must also be modified. This trade-off between faster reads and slower writes is the primary consideration. Indexes do not inherently complicate schema design, slow down non-indexed queries, or require manual updates for consistency.
Read the full bite: Database Index: The Phonebook for Your Data
Question 22 of 30
What is the primary benefit of Go's garbage collector for concurrent network services?
Show the answer
Answer: c · It performs most of its work concurrently with the application, ensuring high responsiveness.
Go's GC is designed to run concurrently with the application, minimizing the duration of "stop-the-world" pauses to maintain responsiveness for services. While pauses are very short, they are not completely eliminated, making option A incorrect.
Read the full bite: Go's Garbage Collector: The Concurrent Cleaner
Question 23 of 30
A social app adds a like_count column directly on the posts table instead of counting rows in a likes table on every read. According to the card, what new problem does this denormalization introduce?
Show the answer
Answer: a · The count can drift out of sync if updates aren't handled atomically, requiring periodic reconciliation
The card's example warns that a missed update or race condition can leave the count wrong, requiring periodic reconciliation, that is the core cost of denormalizing. The tempting wrong answer has it backwards: the point of adding the column is that reads become a fast single column fetch, not a join.
Read the full bite: When to intentionally denormalize a schema
Question 24 of 30
During page navigation, a 75 KB analytics batch must be sent immediately. Which approach best prevents data loss?
Show the answer
Answer: d · Use fetch with keepalive set to true
fetch with keepalive can transmit payloads larger than sendBeacon's 64 KiB cap during page teardown, whereas navigator.sendBeacon would exceed its size limit and synchronous XMLHttpRequest blocks the main thread, harming navigation speed.
Read the full bite: Design client-side event batching and prevent unload data loss
Question 25 of 30
For which task would Node.js Worker Threads provide the most significant benefit?
Show the answer
Answer: c · Processing a large video file to apply a filter.
Worker threads are specifically designed for CPU-bound operations like video processing to offload heavy computation from the main thread. I/O-bound tasks, such as database queries or network requests, are already efficiently managed by Node's event loop and do not benefit from worker threads.
Read the full bite: Worker Threads: True Parallelism in Node.js
Question 26 of 30
What is the main advantage of using a Tag Management System (TMS) for website analytics and marketing scripts?
Show the answer
Answer: b · It allows non-developers to deploy and manage third-party scripts without direct code changes.
The card highlights that a TMS empowers non-technical users, such as marketers, to add, edit, and manage third-party scripts through a web interface, eliminating the need for engineers to manually update website code. While a TMS can indirectly impact performance through better script management, its primary benefit is enabling independent script deployment by non-developers.
Read the full bite: Tag Management Systems: Control Your Analytics Snippets
Question 27 of 30
To prevent data loss in a client-side event batching system when a user closes the tab, which approach best balances reliability and user experience?
Show the answer
Answer: b · Use `navigator.sendBeacon()` within a `pagehide` event listener to send the final batch asynchronously without blocking the page unload.
`navigator.sendBeacon()` is designed for this exact use case, reliably sending data without blocking the unload process. A standard `fetch()` is not guaranteed to complete, and synchronous XHR is a deprecated practice that harms user experience.
Read the full bite: Design a Client-Side Event Batching System
Question 28 of 30
When designing a client-side event batching system, why is navigator.sendBeacon() preferred for dispatching final events during page unload?
Show the answer
Answer: a · It is specifically designed to send data asynchronously and non-blocking, ensuring the request is sent even after the page has unloaded without freezing the UI.
navigator.sendBeacon() is ideal for unload because it's asynchronous and non-blocking, ensuring data is sent without freezing the UI or being canceled by page unload. Option C is incorrect because sendBeacon is a fire-and-forget mechanism and does not provide a callback for server receipt.
Read the full bite: Design a client-side event batching system for a high-traffic app
Question 29 of 30
When initializing UI handlers on a page with external images, which distinction between DOMContentLoaded and window.load matters most?
Show the answer
Answer: d · DOMContentLoaded fires after deferred scripts run but does not wait for images, letting handlers bind earlier
DOMContentLoaded fires after HTML parsing and deferred scripts complete, so you can bind UI handlers before heavy assets like images finish, whereas window.load waits for all subresources. The most tempting distractor reverses the two events: window.load is the one that waits for every asset, not DOMContentLoaded.
Read the full bite: Describe the difference between DOMContentLoaded and window.load
Question 30 of 30
When building a full-bleed landing page hero, which combination of techniques best prevents layout shift while optimizing image delivery across devices?
Show the answer
Answer: c · Use an img tag with HTML width/height attributes, srcset with AVIF/WebP variants, CSS object-fit: cover, and fetchpriority="high".
This approach reserves space to eliminate CLS, lets the browser choose the optimal resolution and modern format, and prioritizes the likely LCP element. Option A is a common mistake because background-image sacrifices native responsive selection, accessible alt text, and browser optimizations while a single 4K JPEG wastes mobile bandwidth.
Read the full bite: How would you optimize and implement a full-bleed responsive hero image?
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.