Real-time Log Processing with Rust — How I Handle Thousands of Logcat Lines Per Second

rust dev.to

The Challenge
Android's Logcat doesn't trickle data. It floods. During active development, thousands of lines per second is normal — system events, app output, background services, all mixed together in one continuous stream.
Most existing Logcat viewers handle this fine until they don't. Memory creeps up. The UI stutters. You miss the exact line you needed.
I wanted HiyokoLogcat to stay smooth no matter how noisy the device gets.

Why Rust for the Backend
The core job is simple to describe: read ADB output, process it, send it to the frontend. But at high volume, "process it" becomes the bottleneck.
Rust handles this naturally. No garbage collector pausing at the wrong moment, predictable memory usage, and zero-cost abstractions that let you write clean code without paying a runtime penalty.
The ADB pipe runs entirely in the Rust backend. Lines are parsed, filtered, and tagged before they ever touch the React frontend.

Keeping the UI Smooth
Sending every single line to the frontend as it arrives is a recipe for jitter. Instead, lines are batched and sent at a controlled rate — the UI stays responsive even when the backend is processing at full speed.
Virtual scrolling on the frontend handles the rendering side. Only the visible lines are in the DOM at any given time, so a session with 100,000 lines feels the same as one with 100.

Filtering at the Right Layer
Filtering happens in Rust, not in the browser. When a user applies a tag or severity filter, the backend does the work — the frontend only receives what it needs to display.
This keeps the React layer simple and fast, and means filtering scales with Rust's performance rather than the browser's.

The Result
HiyokoLogcat stays lightweight even during heavy log sessions. The combination of Rust processing, controlled batching, and virtual scrolling means you can leave it running all day without it becoming a burden on your system.
👉 GitHub: https://github.com/Hiyoyoko/HiyokoLogcat

Source: dev.to

arrow_back Back to Tutorials