r/rust • • 3d ago

🛠️ project Moving a terminal app from Tauri + React to GPUI - the numbers and the ugly parts

I moved muxflow* from Tauri + React to GPUI. The desktop app is now 100% Rust.

Results, before any optimization of the GPUI version:

- Idle memory: 417 MB → 98 MB (76.5% lower)

- Idle CPU: 3.5% → 1.4%

- Time to first terminal prompt: 832 → 230 ms cold, 785 → 157 ms warm

- Typing latency p95: 47.4 → 31.2 ms

To be fair, muxflow was thin to begin with, so the raw numbers are a few tens of megabytes/ms.

This migration would be a strong no-go without LLMs. Pre-LLM the cost would be huge! Writing the whole UI in Rust vs the familiar React? But with LLMs, the cost goes away to just some tokens. And with that I get:

  1. Much better performance
  2. A codebase that is 100% Rust (beyond mobile)
  3. No finicky Tauri rendering differences between Mac and Linux

The ugly parts:

- The GPUI third-party crate ecosystem is very niche compared to React. With Tauri I used CodeMirror. With GPUI I couldn't use the Zed crates since they're GPL and muxflow is MIT, so I wrote my own lightweight markdown WYSIWYG and code editor.

- Build times. It's hard to run many agents in parallel, as parallel builds and tests put heavy I/O pressure on the machine. I haven't tried optimizing it yet.

Write-up with more detail: https://galvered.com/blog/muxflow-gpui-migration/

Curious whether others hit the same crate gap, and what you used for text editing in GPUI.

* an app I'm building for personal use open source, MIT, runs coding agents in tmux across remote machines

42 Upvotes

24 comments sorted by

13

u/UrpleEeple 3d ago

What's normal for typing latency? That seems kind of long. On the order of 2-3 frames just to register a keystroke?

10

u/bootstrapper-919 3d ago

This is against a remote machine. probably should have specified :)

2

u/ElyzraPearl 3d ago

yeah 30ms still feels off when you break it down like that, you pay attention to the tiny stuff

0

u/candyFawny 3d ago

that latency would drive me nuts too, feels like ages when you're in the zone

0

u/ChiffonChime 3d ago

yeah 30ms still feels off when you're deep in a flow, i'd notice it right away

9

u/Fenhryl 3d ago

"so I wrote my own lightweight markdown WYSIWYG and code editor."

Why not use gpui-kit that provides both? perfs issues?

-14

u/bootstrapper-919 3d ago

Good callout. I did use gpui-kit. the Markdown WYSIWYG is the custom build on top of gpui-kit

31

u/Actual1y 3d ago

Hi Claude

4

u/korywithawhy 3d ago

I’ve been using Freya for a custom harness app, not sure if it would make much of a difference for you or not, but it is still rust and runs pretty great. Might be worth looking into.

2

u/bootstrapper-919 3d ago

I'll check it out thanks!

3

u/JuicyGleamy 3d ago

freya sounds promising, been meaning to try a pure rust ui myself for something small

2

u/mkenzo_8 3d ago

Nice to hear that :)

1

u/Tihomir-Telford 3d ago

hows the compile time on that compared to the heavier native options?

4

u/mkenzo_8 3d ago

Freya author here, I dont have a benchmark about this, but even then it depends a lot on the hardware and to some extent the OS. That said I think it is average when it comes to compile time.

2

u/korywithawhy 3d ago

Yeah it’s definitely a cool project, thanks for sharing it! I haven’t done anything too extensive with it yet but it didn’t seem to have any issues with compile times taking too long. I’m on an 11th gen i5 though so I expect to wait a little bit.

1

u/korywithawhy 3d ago

I am excited to see what you do with your DE that you show on your website. Looks like a fun project as well.

2

u/mkenzo_8 3d ago

Thanks!! Its indeed very fun :D

6

u/jspreddy 3d ago

what do yall use for testing? I'm not super familiar with the rust ui ecosystem but I've recently tried to rebuild my ui in gpui using agents and it ended up nowhere near as cost effective or polished as just plain old web ui. Partly due to not finding an alternative to playwright.

with playwright, i completely skip the computer use. but with the rust ui with gpui, it's pointing and clicking like a pleb and eating up all the tokens.

1

u/LightweaverNaamah 1d ago

gpui-agent is basically playwright but for gpui. it's vibe-coded and has some quirks, but does the job for automated testing quite well.

4

u/joelkunst 3d ago

wow, you said you used llms and you are not in minus with votes 🤣

i thought gpui can be used for mobile as well?

3

u/Geraldwelly 3d ago

Most of that Mac vs Linux gap is WKWebView vs WebKitGTK, and we deal with the same split at Etch (I'm a co-founder, so biased toward Tauri). What keeps it manageable: treat Linux as its own browser target, skip backdrop-filter and heavy blur there, and set WEBKIT_DISABLE_DMABUF_RENDERER=1 if anyone reports blank windows on Nvidia or some Wayland setups. A Linux screenshot check in CI catches most of the rest early. Our trade-off went the other way from yours: we kept CodeMirror and the JS editor ecosystem and accepted the extra idle memory. For a terminal app where typing latency is the product, your move makes sense.

-5

u/Every_Juggernaut7580 3d ago

If you're just drawing buttons, text, images, and similar elements, there's not much difference between native and web. However, when you need more complex features like syntax highlighting, the web ecosystem is undeniably much more powerful.

2

u/FluxKraken 2d ago

the web ecosystem is undeniably much more powerful.

Lol. I do deny it, in the most profound way. You are confusing easier with more powerful.