DEV Community

Ian Cowley
Ian Cowley

Posted on

Replacing Electron with .NET 10: Writing a zero-latency, SIMD-accelerated IDE

Modern development tools have normalized lag. As an industry, we’ve somehow accepted that opening a text editor should consume 2GB of RAM, and that typing rapidly should occasionally stutter while an extension parses a JSON tree on the UI thread.

The standard playbook for building cross-platform editors today is to use Web Technologies (Electron/Tauri) or to drag along a decades-old monolithic C++ architecture.

But when it comes to high-performance, memory-intensive data processing, C# and .NET 10 are absolute bare-metal contenders. We don't need to default to browser engines or Rust to get sub-millisecond startup times and zero-allocation execution.

To prove it, I wrote SpanCoder: a cutting-edge, extensibility-first IDE built entirely on .NET 10 and Avalonia UI. It features a custom Skia-rendered canvas, a zero-allocation piece-table text buffer, hardware-accelerated SIMD parsing, and a heavily decoupled process architecture.

Here is how you build a premium, out-of-process IDE with C# without waking up the Garbage Collector.

1. The Death of the Monolith: Out-of-Process Resiliency

If a single third-party extension crashes, your IDE should not freeze.

Instead of a monolithic architecture where a heavy UI thread handles rendering, buffer parsing, and extensions, SpanCoder isolates everything into dedicated processes communicating over low-latency binary-serialized TCP channels and standard Stdio redirects:

  • SpanCoder.App (Shell UI): Handles only UI layout, custom canvas rendering, and input events on the main thread.
  • SpanCoder.Engine: A completely isolated background process handling the heavy text data structures and file I/O.
  • Language Servers (LSP) & Debuggers (DAP): Spawned entirely out-of-process via standard JSON-RPC.
  • Plugin Hosts: Third-party code runs in external sandboxes.

Because the UI is isolated, we maintain an Active Replay Ledger. If the background text engine crashes due to an out-of-memory error from a massive file, the UI instantly respawns it, replays the transaction ledger over the socket, and restores the exact state. You lose zero keystrokes, and the UI never locks up.

2. The Text Engine: Piece Tables and Zero Allocations

String concatenation is the enemy of performance. If you open a 2GB log file and type a single character in the middle, re-allocating that array will bring the system to its knees.

SpanCoder’s engine uses a Piece Table Buffer. Text modifications are stored as a sequence of span descriptors pointing either back to the immutable original file on disk or to a thread-safe, pre-allocated ArrayPool<char>.

Edits are O(edits) rather than O(document length).

When the custom Skia UI canvas needs to render a line, the engine checks if the segment lies contiguously in memory. If it does, it yields a ReadOnlySpan<char> directly back to the UI. The bytes go from the buffer to the screen with exactly zero heap allocations.

3. SIMD-Accelerated Line Indexing

When you insert a new line at the top of a 100,000-line document, the byte offsets for the remaining 99,999 lines all shift. In a standard linear loop, this takes time.

To fix this, SpanCoder maps absolute byte offsets using hardware intrinsics. When an edit occurs, we use .NET 10 Vector<long> from System.Numerics to shift the line array adjustments in parallel blocks. If your hardware supports AVX-512, we update 8 lines per CPU clock cycle.

C# is routinely underestimated in the data analytics and processing arena, but when you leverage memory-mapped files and SIMD instructions, it performs like a native, unmanaged language.

4. Sub-Millisecond Startup via Native AOT

Modern C# isn't just fast at runtime; it can compile down to a single, zero-dependency native executable.

However, to survive Native AOT compilation, you have to eliminate Reflection entirely. Most IDEs use reflection at startup to scan for commands, menus, and plugins, which destroys cold-start times.

SpanCoder utilizes C# Source Generators. When you tag a method with [Command] or [MenuItem], Roslyn analyzes it at compile-time and injects a static routing dictionary directly into the build.

The result? Zero reflection, complete trimmer safety, and an IDE that opens virtually the moment you click the icon.

5. Built for the Modern Workflow

While performance is the foundation, an IDE has to actually be useful. SpanCoder wraps this high-performance core in a premium developer experience:

  • Zero-Config Local AI (Ghost Text): Auto-detects local Ollama instances and pulls the qwen2.5-coder model in the background. It uses Fill-in-the-Middle (FIM) to render sub-100ms inline autocompletions (Ghost Text) completely offline, with zero API costs.
  • Embedded AI Agent (YOLO Dev): A built-in terminal and chat agent that coordinates LLM reasoning and workspace tool executions in the background engine without blocking the UI.
  • Hardware Debugging: Built-in graphical target managers for flashing RP2040s or STM32s, complete with an embedded PTY terminal and Microcontroller DAP stepping.
  • Real-Time Collaboration: Synchronizes editor buffers between developers using a low-latency Conflict-free Replicated Data Type (CRDT) protocol over WebSockets.

The Takeaway

It is incredibly easy to look at the current software landscape and assume that everything has to be built on web technologies to be cross-platform, or built in C++/Rust to be fast.

SpanCoder is proof that .NET 10, combined with Avalonia UI and a healthy dose of mechanical sympathy, provides an incredible sweet spot. C# allows you to build safe, highly abstracted code where you want it, and terrifyingly fast, pointer-manipulating, zero-allocation data engines where you need it.

SpanCoder is currently under heavy development.

👉 Check out the architecture here: github.com/ian-cowley/SpanCoder

Top comments (0)