Performance
508 bites tagged Performance — interview questions with model answers, and 60-second explainers.
Volcano Model: Pipelined Query Execution
Volcano makes every query operator a generator yielding one tuple per call. Scans, joins, and sorts stream data upward through open-next-close interfaces without materializing intermediates. The hidden cost is millions of virtual calls that stall modern CPUs.
What is vectorization in NumPy and pandas?
Tests if you know why NumPy operations beat Python loops via contiguous memory and C-level SIMD. A strong answer defines vectorization as array-wide operations without explicit loops, contrasts a ufunc to a for-loop, and cites interpreter overhead removal.
Most efficient way to convert list of dicts to pandas DataFrame
Tests knowledge of vectorized DataFrame construction versus slow row-wise assembly. Answer: pass the list directly to pd.DataFrame(data); C-backed and handles missing keys as NaN. Red flag: recommending loops with pd.concat or iterative DataFrame building.
Vectorization: Ditch the Python Loop
Vectorization means issuing one batch command to C-backed arrays instead of looping in Python. Use it for million-row DataFrames or matrix math. The footgun is treating apply() as vectorized, or silently materializing giant temporaries that exhaust RAM.
How do you programmatically sync CSS animation progress to scroll?
This tests scroll-driven APIs beyond legacy scroll listeners. A strong answer names CSS animation-timeline and scroll-timeline declaratively, plus the Web Animations API with ScrollTimeline in JS. A red flag is using only requestAnimationFrame style mutations.
CSS will-change: purpose, appropriate use, and overuse consequences
Tests whether you know will-change is a last-resort hint, not a default. Strong answers: hint imminent changes, toggle via script, and warn that overuse wastes memory. Red flag: leaving it in CSS permanently or applying it preemptively to many elements.
Create a staggered list fade-in using only CSS
Tests CSS animation orchestration via keyframes and delay strategies. Great answers use :nth-child or --index variables for scalable staggering, set fill-mode forwards, and honor prefers-reduced-motion.
Why is animating transform preferred over top or margin-left?
Grasp of the rendering pipeline and frame rate. A strong answer says transform skips layout and runs on the compositor, while top and margin-left force layout and drop frames. claiming both are equally fast or that only syntax differs.
How would you use srcset and sizes for responsive image performance?
This tests responsive image selection in the browser. A strong answer covers srcset with w or x descriptors, sizes for layout width hints, and the browser picking before CSS loads. Red flag: suggesting JS detection or CSS backgrounds instead.
Key differences between responsive and adaptive design, and when to choose adaptive
It tests layout strategy trade-offs beyond media queries. A strong answer contrasts responsive fluid grids with adaptive device-specific layouts. Red flag: claiming they are identical or that adaptive means more breakpoints.
How can CSS aspect-ratio and modern layout properties prevent CLS?
Set width/height attributes, use CSS aspect-ratio for responsive scaling, and reserve container space with min-height. Your grasp of reserving render space before media loads.
Propose two strategies for lazy-loading SPA localization data
This tests code-splitting for i18n. Strong answers cover: first, per-locale dynamic imports creating separate chunks per language; second, namespace splitting fetching only keys for active UI. Red flag: ignoring bundler chunking or Core Web Vitals impact.
Display a dynamic uptime claim without hurting Core Web Vitals
Tests separation of data and rendering paths for dynamic claims. Pre-compute the metric in a background job, cache at the edge, and inject via SSR to avoid blocking the main thread. A red flag is synchronous DB lookups or CSR that delays interactivity.
Outline a strategy to improve LCP and CLS for blog article pages
Fix LCP with server speed, resource hints, critical CSS; fix CLS with explicit sizes and font-display. Pinpointing LCP/CLS via render, not generic tips.
Diagnose CI/CD queue bottlenecks and propose three throughput improvements
This tests CI/CD scheduling and queuing theory. A strong answer profiles queue versus execution time, then proposes right-sizing parallelism, aggressive caching, and workload sharding. A red flag is jumping straight to adding agents without measuring first.
How do you diagnose a progressively slower CI pipeline?
Profile stage durations and critical path, audit runner CPU/memory/disk, flag flaky or late-failing tests. data-driven CI diagnosis across pipeline topology, runner resources, and test quality.
APM: Turning System Metrics into Business Meaning
APM turns system metrics into business meaning by tracking software performance and availability. It matters most when slowdowns threaten service levels. The footgun is gathering data without translating IT metrics into what the business actually cares about.
How would you use Perfetto and Trace.beginSection to find a non-obvious bottleneck?
Tests correlation beyond CPU sampling. Covers coarse Trace.beginSection to limit 1-10us overhead, recording app ATrace with CPU/scheduling tracks, and correlating slices against scheduler latency. Red flag: omitting overhead or ignoring Perfetto SQL queries.
Explain generational GC in ART and why onDraw must avoid allocations
Covers young-gen nursery, mark-sweep fallback, and why a 5-10ms GC pause misses 16ms frame deadline. ART generational GC and onDraw allocation hazards. Blaming GC without linking allocation to frame timing.
Explain cold, warm, and hot app startups and three cold-start optimizations
Cold means no process; warm means process lives but activity recreates; hot means activity resumes. Three fixes: lazy-load deps, trim Application.onCreate, defer blocking I/O. App startup modes and tuning tactics.
Diagnose Android UI jank using Android Studio's Profiler
Start with CPU Profiler for traces over 16ms and main thread blocking; check Memory Profiler for GC. Isolating frame drops to main thread work or GC via Android Studio Profiler. Using Logcat alone or blaming hardware.
What is overdraw in Android UI and how do you reduce it?
This tests GPU fill awareness. A strong answer defines overdraw as redrawing pixels repeatedly, names Debug GPU Overdraw's color overlay, and offers fixes: remove unnecessary backgrounds and flatten hierarchies. Red flag: confusing this with CPU layout issues.
What is an Android memory leak? Give a Context example and fix.
Tests understanding of Activity Context retention preventing GC. A strong answer defines a leak as unreachable objects, gives a static singleton example, names LeakCanary, and fixes it with Application Context. Red flag: blaming GC or suggesting System.gc().
Diagnose Compose recomposition issues and explain lambda stability
Tests Compose skipping and stability. Strong answers name recomposition counts, compiler metrics, and immutable state, then explain unremembered lambdas create new instances and prevent skipping.
Get Performance bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.