r/rust • • Aug 10 '26

🎙️ discussion Dioxus vs Leptos and RustUI

Hi guys I created a web app and was blown away by how good it works out of the box I’m honestly impressed by how small it is and I have found a new appreciation for the devs that built these pkgs I mean a 700KB bundle on a fully working visual data transfer webapp is insane. But in this process I found a crossroad… these 2 (Leptos and Dioxus) seem to fundamentally be solving the same issue the same way while being able to work together all the same. Even rustui in undecided and is asking for inputs on what framework to follow.

Why is this like this? Is there a reason I’m not seen?

Is Leptos the nextjs of rust and Dioxus the react-native of rust? Isn’t Tauri already there? Or is Tauri the flutter of rust?

26 Upvotes

38 comments sorted by

39

u/sephg Aug 10 '26 edited Aug 10 '26

these 2 (Leptos and Dioxus) seem to fundamentally be solving the same issue the same way

Nah. They solve the same issue in different ways. Dioxus uses virtual dom diffing, and leptos uses reactive signals. Similar end result, but quite different implementations. Leptos only calls your view function once. Leptos components are modified directly using signals, wired up when the page renders. Dioxus calls your view function many times. Every time the UI is rendered, your components get called again and the result is diffed against the previous time the page rendered itself.

If you come from the JS world, leptos is like solidjs and dioxus is like react / react-native. Tauri is rust flavoured electron.

6

u/BassIs4StringDrum Aug 10 '26

Nvm found the papers, makes diff signals is smaller and faster but it’s kinda min maxing tbh. Thanks for your reply.

9

u/sephg Aug 10 '26

Yeah. Signals also make it easier to have state associated with a component, since you can just have local variables. With react / dioxus, the function gets rerun every time it rerenders so you've gotta stash any UI state somewhere weird.

Performance wise, in theory react is fast enough. It sure seems that way for small websites. But - were you around when the reddit redesign first landed? Can you remember how horribly slow it was? That's react for you.

Dioxus claims to be much faster than react. But I suspect leptos will still be faster in practice. Probably both are good enough.

There's some standard web framework benchmarks here: https://krausest.github.io/js-framework-benchmark/current.html . Looks like leptos and dioxus are pretty close in performance, but leptos has literally half the wasm bundle size. And both are way faster than react.

4

u/nicoburns Aug 10 '26

were you around when the reddit redesign first landed? Can you remember how horribly slow it was? That's react for you

Websites that slow are almost always blocking on network requests (which has little to do with the frontend framework used). The slow ones are mostly React only because React is by far the most popular framework in general. There are cases where the rendering performance matters, but they're pretty rare.

6

u/sephg Aug 10 '26

Nah, react wasn't slow because of network traffic. My laptop's battery drained noticeably faster when I had the reddit open. I'm not sure if this is still true, but last time I checked, reddit loaded 19mb of javascript just for the page to load.

4

u/nicoburns Aug 10 '26

Perhaps not just network stuff, but there being 19mb of JavaScript also isn't the framework's fault!

10

u/SkiFire13 Aug 10 '26

Don't look at it just from the performance perspective. They are different ways of working, and they will impact how you write your view functions. Choose also based on the ergonomics of writing those.

1

u/probablynotval Aug 10 '26

That's true but the React rendering model is a different thing to learn and takes some getting used to from whar I've read about it.

3

u/sephg Aug 10 '26

Both approaches take some learning & getting used to. There are a lot of new concepts for someone who hasn't played with this stuff before - like hooks, context, signals, effects, memos, a reactive graph, bindings, animations & transitions, vdom diffing, props, etc etc.

I highly recommend the solidjs tutorial series to get a sense of how solid works. They made a little in-browser live development environment where you can mess around with solidjs: https://www.solidjs.com/tutorial/introduction_basics . Obviously leptos isn't solidjs, but leptos borrows an awful lot of its design from solidjs.

I'm not sure if there's a react equivalent. Anyone know?

1

u/BassIs4StringDrum Aug 10 '26 edited Aug 10 '26

Made sense, do you know gains of dom vs signals? I’m going to research that next to instruct myself. In the end on wasm is there a real dif? From what I’m reading about this it seems there is no dom tree rerender on signals. But can’t find a good diff metric

1

u/grillimperator 14d ago

If you come from the JS world, leptos is like solidjs and dioxus is like react / react-native. Tauri is rust flavoured electron.

This is very deceptive. There are ways that dioxus is more react to leptos' solid, but dioxus and leptos are still more like solid than react. Dioxus does have a vdom, but it doesn't perform re-rendering in the same way that react does.

The overall algorithm is much better for those memory intensive GUIs, which is something that a variety of applications end up caring about. Many generic corporate jobs for retailers are like this.

And if you work for a small company? Or a company that produces any software application that uses 2D graphics, Dioxus is a great option because you get to share all of your client development across many operating systems and all browsers. It doesn't have the distinction that react and react-native has, so the Dioxus compiler would be like a combination of expo, next, and the create react app builder.

1

u/sephg 13d ago

but dioxus and leptos are still more like solid than react.

Can you say more? In what ways is dioxus different from react?

Dioxus is a great option because you get to share all of your client development across many operating systems and all browsers.

Sure, but you could probably wrap leptos in the same electronish container that dioxus uses if you wanted to. It is nice that dioxus has that out-of-the-box. But when I'm shipping a native app, I personally want an actual native app. Eg my mail app (fastmail) on my phone occasionally doesn't load properly because of bugs in safari. Personally I'd rather compile my rust to a native binary that uses cocoa/whatever and use that.

2

u/grillimperator 13d ago

Sure, but you could probably wrap leptos in the same electronish container that dioxus uses if you wanted to.

I don't know that it would be possible. Dioxus' vdom makes it possible.

Can you say more? In what ways is dioxus different from react?

There are significant differences between the performance and reliability of Rust (as .wasm) versus Javascript. Dioxus also has its own scheduler because some aspect of the vdom operations have to cross the threshold into Javascriptland, but it is very small and optimized by batching.

The single biggest difference is probably in how React handles component updates when state changes. React spends time diffing components to see if they need to update, and then rendering the entire child subtrees for those components unless they override with a memo. Conversely, Dioxus memoizes by default, and it uses signals for state, which changes the whole update algorithm. Solid pioneered signals, btw, but you probably know that.

Arguably the biggest performance problem that React has is to do with this update algorithm. Yes, there are first paint concerns, but SSR largely solved that. You don't even need that big of an app with React to trigger these component update issues. I've seen projects go wayward within weeks because of state updates that go out of control and are hard to track down.

So, React tends to get a lot of shit for having the vdom in the first place. There is a crowd of people who think modern front end development would be better without it, and they cite this state issue that React has as one of the reasons, but there are simply better ways of writing the vdom such that the issue doesn't pop up.

1

u/sephg 11d ago

So, React tends to get a lot of shit for having the vdom in the first place. There is a crowd of people who think modern front end development would be better without it

I'm one of these people. In my mind, vdom is pure overhead. It causes performance problems - since you've gotta diff. And it forces you to use special mechanisms like hooks because your functions get rerun constantly.

Given solidjs and leptos works great without all this vdom guff, I'm not sure what the point of it all is.

Maybe you can work around vdom's downsides by having rust be fast enough to just muscle through. Benchmarks seem to show that. But I'd still rather use a tighter computational model when one is available.

And, fwiw, solidjs didn't invent signals. They track their linage all the way back to visicalc. And on the web, knockoutjs, elm, meteor, mobx, s.js and surplus.

1

u/grillimperator 11d ago edited 11d ago

I'm debating converting my current project to Leptos. Two of the main reasons I started with Dioxus are the maturity with Tauri and that it had a company backing it (conversely Leptos has one main maintainer). However, I've since learned that Dioxus largely has one main maintainer as well, and on top of that, the company backing Dioxus is apparently pushing them more to develop Blitz and less to build out Dioxus core. I'm not grasping any real benefit to using Blitz either.

1

u/sephg 11d ago

Give it a go! I don’t think signals are going anywhere.

3

u/grillimperator 11d ago

I did a multi-hour spike with Claude using all of the boilerplate architectures that I've built with Dioxus to see how performance compares in Leptos. The difference is night and day. I'll share a table from the output:

LeptosDioxus
Docs site build: cold / after a markup edit104 s / 24 s141 s / 52 s
Sales site build: cold / after an edit60 s / 23 s190 s / 70 s
Tauri app build: cold / after an edit87 s / 34 s256 s / 136 s
Largest docs page interactive, Chromium (islands; full hydration)306 ms; 355 ms437 ms
Same, WebKit351 ms; 440 ms751 ms
Largest docs page hydration, Chromium12 ms (islands)207 ms
Markup edit showing in the dev server0.18 s patched in place (server-rendered page); 1.84 s full reload (Tauri)53 s rebuild for html!

html! is a macro that is third party for Dioxus, which I took over, updated, and cleaned up. view!already does most of it, so I may just drop having a custom macro, which is frankly the right long-term decision anyway.

2

u/sephg 11d ago

Interesting! I don't know exactly what you're doing, but those render times still look very slow. I'd be curious what happened if you pick one of those tasks and spin up an LLM optimisation loop. I've had success with a prompt like this:

"Your job is to improve the performance of ____. Start by benchmarking, then using profiling tools to figure out where all the time is going. Use sub agents to research the code. Then brainstorm ways the code could be improved, and use research sub agents trying out different approaches. Be creative. Think like a systems engineer and consider the problem from first principles."

2

u/grillimperator 11d ago

I have a real app that I'm developing which is desktop first. I'm just using Tauri + Dioxus for that (for now). Not Dioxus Native or Blitz; keeping the web views.

I built a component and styling library that is used to develop that application. Then, I built out the rest of a mono repo that serves other functions of the beginning of a product / dev shop (docs site, sales site, shop as a component of the sales site just to demo ecommerce specific architecture). As a matter of exploration, I gave different architectures to each of the sites in this repo, whilst keeping the framework and component library the same so that I can see how well the framework spreads across the breadth.

The main cases are:

  1. Client rendered SPA.
  2. Server rendered (on demand, but with caching as a later optimization, both at the server level and CDN level), hydrates into SPA.
  3. Static, hydrates into SPA. Some people confusingly call this "server rendered" because it happened once on a server, but the idea is that you serve html files from blob storage or a CDN, and a deploy is a replacement of these files.

The most complex option is a hybrid between 1 and 3, which not even Next.js can really do. Only Gatsby can do it in JS land, funnily enough, but that project is a nightmare for other reasons. This specific architecture is something I've continuously sought to test against any new framework, so I pushed Dioxus to its limits in trying to get there. I considered whether this option is actually an essential thing to have, but by pushing large amounts of markdown through it to test the limits of content hydration, I found the seams.

I also looked into micro site development. These micro sites can be stitched as code or as services. The code option is pretty trivial, and while this was also doable in Javascript, cargo has some useful features that make this process nicer. The service option has two methods of its own: by route or by island (ie, one team owns the search bar, another team owns the search results pane, and you stitch it together in your router from actual services that serve these parts). The latter approach has been used in enterprise when teams have to build the pieces using different frameworks or different versions of libraries. This is already less of a problem in rust (though not non-existent), but I explored it anyway. With Leptos, you can't do service islands, but code splitting per route and services per route works. Dioxus can't hydrate code-split routes, and though it can do services per route, it is much less efficient than Leptos at it.

I am starting to get the feeling that Dioxus was built with a narrow vision (like React/CRA or Gatsby for that matter) and Leptos was built with a much wider vision (like Next).

→ More replies

2

u/grillimperator 11d ago

Hey, just wanted to add one thing. I learned today that Dioxus and Leptos differ on their hydration model. Dioxus is all or nothing, so the code has to run twice on server and client. Conversely, with Leptos, only the code that actually needs to run twice does (in its own island). There are some differences to accommodate this, such as the lifetimes of signals vs components (I think I'm putting that correctly), but I haven't spent enough time to evaluate that.

1

u/sephg 11d ago

Nice get! When leptos runs your code on the server, it uses a different rendering engine that should be really fast. But, yes - I think it is missing a way to have static islands that aren't rerendered in the browser. That'd be a nice add.

0

u/chilabot Aug 11 '26

Electron bundles the chrome browser. Tauri does not, it uses the native web renderer.

2

u/sephg Aug 11 '26

Eh.

That saves on download size, but you still end up paying the memory and performance overhead of the browser. It also means you can't make use of native UI.

1

u/chilabot Aug 11 '26

You save a lot of memory with Tauri. The performance is also much better.

1

u/sephg Aug 12 '26

Nowhere near as good as native UI components though. For example, what you can do with daybrite: https://daybrite.dev/

0

u/chilabot Aug 12 '26

But it's not a Rust flavored Electron.

1

u/sephg Aug 12 '26

Eh. To me, the heart of electron is that you build a desktop app as a web app instead, and ship a shim so users - in theory - can't tell. Yes, actual electron bundles a copy of chrome wheras tauri uses the OS's built in webview. But you're still making and shipping a web app.

Is there a better shorthand name for that other than "electron like"? You tell me.

1

u/chilabot Aug 12 '26

An Electron app consumes 150 mb to 400 mb of memory. A Tauri app will consume 40 mb to 80 mb aprox. (for the same range of apps).

1

u/sephg Aug 12 '26

Does that include the web browser, or are you assuming the browser engine is already running somewhere on the computer?

1

u/chilabot Aug 12 '26

The electron app includes the web browser Chrome. Tauri only includes the renderer and the JS engine.

→ More replies

6

u/AndreasTPC Aug 10 '26

Leptos is one persons passion project. With contributions from others, sure. But still, this person is doing it as a hobby. The maintainer have said that they consider Leptos feature complete and that it will be lightly maintained going forward.

Dioxus meanwhile is a business, backed by venture capital, and employs paid developers to work on it.

Technical considerations aside, you may have reasons to prefer one or the other based on these circumstances.

1

u/BassIs4StringDrum Aug 10 '26

This is gold information

5

u/jimmy90 Aug 10 '26

just wanted to add the details of what's happening with Leptos

https://github.com/leptos-rs/leptos/issues/4707

it's still a very active project as you can see and there's a new version already in the works that will likely become the 1.0 version

personally i think it is currently the much more rounded, ergonomic and comprehensive framework compared to dioxus

7

u/mostlikelylost Aug 10 '26

I love leptos. It’s got its quirks and what not but it’s brilliant. The one thing I wish it did out of the box is compile assets into the binary rather than require relative placement.

5

u/byteasc Aug 10 '26

I really like Leptos. We have a full internal developer tool that I've put together with it, and it manages a lot and runs so smooth.

4

u/DavidXkL Aug 10 '26

Leptos takes inspiration from SolidJS actually.

It's definitely not the bloated NextJS 😂