tauri-apps/tauri

[bug] Frequent hiding and displaying of webviewWindow significantly increases CPU usage

moom-en opened this issue · 1 comments

Describe the bug

Thanks to the official for proposing the webviewWindow hiding and displaying functions in my last issue and adopting them so quickly. Because my tauri v2 project is used in the production environment, I cannot provide you with video recordings. However, after my comparison, frequent Showing and hiding webviewWindow CPU usage is about 2%-3% higher than changing the position of webviewWindow. so currently I still hide and show by changing the position of webviewWindow, because it takes up much less CPU. Finally, I would like to make a small suggestion: If you can add a option parameter config to webview.show(config), you can configure the display location is even more perfect

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 129.0.2792.52
    ✔ MSVC:
        - Visual Studio Enterprise 2022
        - Visual Studio ���ɹ��� 2022
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ Cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.17.0
    - yarn: 1.22.19
    - npm: 10.8.2

[-] Packages
    - tauri [RUST]: 2.0.0-rc.16
    - tauri-build [RUST]: 2.0.0-rc.13
    - wry [RUST]: 0.44.1
    - tao [RUST]: 0.30.2
    - @tauri-apps/api [NPM]: 2.0.0-rc.6
    - @tauri-apps/cli [NPM]: 1.4.0 (outdated, latest: 1.6.2)

Stack trace

No response

Additional context

image