InterviewStack.io LogoInterviewStack.io

Performance and Code Optimization Questions

Covers techniques and decision making for improving application and code performance across levels from algorithm and memory access patterns to frontend bundling and runtime behavior. Candidates should be able to profile and identify bottlenecks, apply low level optimizations such as loop unrolling, function inlining, cache friendly access patterns, reducing branching, and smart memory layouts, and use compiler optimizations effectively. It also includes higher level application and frontend optimizations such as code splitting and lazy loading, tree shaking and dead code elimination, minification and compression, dynamic imports, service worker based caching, prefetching strategies, server side rendering versus client side rendering trade offs, static site generation considerations, and bundler optimization with tools like webpack Vite and Rollup. Emphasize measurement first and avoiding premature optimization, and explain the trade offs between performance gains and added complexity or maintenance burden. At senior levels expect ability to make intentional trade off decisions and justify which optimizations are worth their complexity for a given system and workload.

HardTechnical
18 practiced
Explain compiler techniques such as operator fusion, kernel auto-tuning, and memory planning (used by XLA or TensorRT), how they reduce inference time and memory footprint, and why hand-optimized kernels sometimes still outperform auto-compilers in practice.
EasyTechnical
32 practiced
Briefly explain what 'zero-copy' means for CPU-to-GPU data transfer in an inference pipeline and name one API or technique that enables zero-copy or reduced-copy transfers. Discuss one trade-off of that approach.
EasyTechnical
16 practiced
You need to run inference of an ML model inside the browser using WebAssembly. List concrete steps and optimizations to minimize initial download and startup time for users on slow networks, including model size, lazy loading, caching, and compilation strategies.
MediumTechnical
23 practiced
A newly deployed model server intermittently returns 500 errors and escalates during load spikes. Describe an incident response checklist focusing on performance causes, required instrumentation to root-cause, and short-term mitigations and long-term fixes to prevent recurrence.
EasyTechnical
19 practiced
Explain the practical differences between FP32, FP16 and bfloat16 in terms of exponent, mantissa, dynamic range, and precision. For an AI inference workload, when would you prefer mixed precision, and what pitfalls (numerical stability, accumulation) should you watch out for?

Unlock Full Question Bank

Get access to hundreds of Performance and Code Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.