tauri: [bug] Bad performance on linux
Describe the bug
I’m experiencing very bad performance on linux when handling lots of DOM elements. In my project you can drag select items, and selecting lots of them causes ui to lag/freeze on linux.
I made repo that demonstrates the problem: https://github.com/aalhitennf/tauri-performance
Reproduction
- Clone the repo
- Install packages with npm install
- Build with npm run build
- Run the executable from src-tauri/target/release
- Start drag selecting items with left mouse button (default file manager behaviour) from up to down and let the autoscroll happen on window border
- UI starts to lag a lot
Expected behavior
App runs flawlessly in firefox (linux), electron (linux) and when built on windows, problem happens only on my linux installation.
Platform and versions
Environment
› OS: Arch Linux Rolling Release X64
› Node.js: 17.9.0
› npm: 8.5.5
› pnpm: 6.32.11
› yarn: Not installed!
› rustup: 1.24.3
› rustc: 1.60.0
› cargo: 1.60.0
› Rust toolchain: stable-x86_64-unknown-linux-gnu
webkit2gtk 2.36.1-1
Stack trace
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 25 (8 by maintainers)
I don’t think this issue should be closed.
I don’t mean to sound rude, but performance on linux is currently atrocious due to webkitgtk.
I have a very basic app, interacting with a content editable in the app causes paints to take between 70-300ms, just to enter a single character. I’m using a 2021 Dell XPS, needless to say anything else performs just fine. It also performs great on all other platforms, never dropping below 60fps, never a dropped frame. (Including macOS which is also webkit 😕 )
I think there are a couple possible paths forward:
Hey @LifeIsStrange - we are not planning on making Servo into a browser. The research right now is to turn it into a webview, which is a much different value proposition.
At first glance at your code, you’re creating about 3000 DOM element and that is expected to have lags and ui freezes for two reasons:
What you should do:
Any guides on how to improve the performance on linux?
I recently turned to Asahi linux on a MBP Max, the basic tauri app built with Solid.js is basically unusable on linux, even the css animation is laggy, while on macOS it’s all good.
Hi! I’m curious how the development of servo as an alternative target webview is going.
I don’t see any more mentions of servo in the github org or on twitter. There is a servo discussion where tauri was mentioned late last year, but nothing since.
Is this design still being considered? Is the development public?
WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYSis the default value (and it’s also not an env var if i got that right). I guess it’s just webkit(gtk) not holding up that well🤷 Oh and hardware acceleration in a browser context was/is generally in a bad state on linux, so maybe that adds up too.SolidJS actually improved performance greatly. There is still slight “lag” or choppiness, doesn’t feel as smooth as in other browsers/platforms but i guess that is fine for now since handling that large amount of elements is very rare case. I’ll look into the virtual scroller too.
We do enable this one: https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html#webkit-settings-set-enable-accelerated-2d-canvas
Though maybe it helps if we use this one too: https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html#webkit-settings-set-hardware-acceleration-policy