tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
83.89k stars 2.52k forks source link

[bug] WebKitWebProces high CPU usage #7183

Open xueweiwujxw opened 1 year ago

xueweiwujxw commented 1 year ago

Describe the bug

image

After compiling on Ubuntu 20.04, I put the output on another Ubuntu 20.04 computer to run. The system on this computer is newly installed. The CPU usage of WebKitWebProcess is abnormally high, but it is normal on my local machine. My web code has not done much, only websocket communication once per second.

Especially after the popup appears, the CPU usage will double directly.

Reproduction

I'm sorry I cannot provide the complete code, but I can explain the frameworks and configuration files I am using.

Expected behavior

It shouldn't have such a high usage. On my local machine, it only has a little over 20% usage, but on the target machine, it has at least 700% usage.

Platform and versions

[✔] Environment
    - OS: Ubuntu 20.04 X64
    ✔ webkit2gtk-4.0: 2.38.6
    ✔ rsvg2: 2.48.9
    ✔ rustc: 1.70.0 (90c541806 2023-05-31)
    ✔ Cargo: 1.70.0 (ec8a8a0ca 2023-04-25)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 16.19.0
    - pnpm: 7.30.0
    - yarn: 1.22.19
    - npm: 8.19.3

[-] Packages
    - tauri [RUST]: 1.2.4
    - tauri-build [RUST]: 1.2.1
    - wry [RUST]: 0.23.4
    - tao [RUST]: 0.15.8
    - @tauri-apps/api [NPM]: 1.3.0
    - @tauri-apps/cli [NPM]: 1.3.1

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite
Done in 3.98s.

local machine: Linux 5.15.0-73-generic #80~20.04.1-Ubuntu SMP Wed May 17 14:58:14 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
target machine: Linux 5.15.0-67-generic #74~20.04.1-Ubuntu SMP Wed Feb 22 14:52:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Stack trace

No response

Additional context

No response

xueweiwujxw commented 1 year ago

It seems that the problem is caused by the Mui animation effect. After disabling it with the following code, the usage has significantly decreased, with the highest usage around 100%. This issue usually occurs during page switching or Menu rendering. However, both my local machine and the target machine are using integrated graphics, so it may be because the integrated graphics on my local machine are slightly stronger.

const tstheme = createTheme({
  components: {
    MuiCssBaseline: {
      styleOverrides: {
        '*, *::before, *::after': {
          transition: 'none !important',
          animation: 'none !important',
        },
      },
    },
  },
  transitions: {
    create: () => 'none',
  },
});