Lessons from Building a High-Performance Electron App
Electron has a reputation for being slow. Here's how we achieved 60fps recording with < 200MB memory usage through careful optimization.
Lessons from Building a High-Performance Electron App
Electron gets a bad reputation. "It's just a Chrome tab," people say, implying that any Electron app is destined to be a bloated memory hog. After spending two years building One Rec on Electron, we can say confidently that the framework is not the bottleneck — the choices you make on top of it are.
Memory: The 200MB Budget
We set ourselves a hard target: One Rec must stay under 200MB of resident memory during active recording. This forced discipline across the entire stack. We use a single BrowserWindow for the main editor and render the recording preview in an OffscreenCanvas to avoid creating additional renderer processes. Large assets like video frames are stored in shared ArrayBuffers that the main process and renderer can access without copying.
IPC: The Hidden Bottleneck
Electron's inter-process communication is surprisingly expensive if used carelessly. Early prototypes sent raw frame data over IPC, which serialized and deserialized megabytes of pixel data sixty times per second. We eliminated this by moving frame processing to native addons written in Rust that communicate through shared memory. IPC is now reserved for lightweight control messages — start, stop, seek — that are measured in bytes, not megabytes.
Native Addons for Heavy Lifting
The recording pipeline, video encoding, and GPU compositing all run in native Rust modules loaded via Node-API. This gives us predictable performance without garbage collection pauses. The Rust layer handles frame capture using platform-native APIs (ScreenCaptureKit on macOS, DXGI on Windows), encodes to H.264 or H.265 using hardware encoders, and writes directly to disk. The JavaScript layer orchestrates the pipeline but never touches raw pixel data.
Startup Time
Cold start time is critical for a recording tool — when a user wants to capture something, they want it now. We reduced startup from 3.2 seconds to under 800 milliseconds through aggressive code splitting, lazy module loading, and precompiling the V8 snapshot. The recording overlay window is pre-created and hidden at launch so it can appear instantly when the user presses the hotkey.
The Takeaway
Electron is a tool, and like any tool, performance depends on how you use it. The key insight is to keep JavaScript in its lane — UI rendering and orchestration — and delegate compute-heavy work to native code. With that architecture, Electron gives you a mature, well-documented platform for building desktop apps without sacrificing performance.