Cargo tauri build result in very slow program

My app 'danceOmatic' is running well in dev mode (cargo tauri dev)

When I build the program, running cargo tauri build it becomes very slow.

link to repo and Branch I'm currently on

Frontend: YEW 0.21
Backend: Tauri 2.0

I run on a macOS, which means it utilizes webkit from Safari.

Is there a key-change i should make in my setup?

For now config.toml is called from Backend. Is that the issue?
Is it the video format mp4?
Anything else that courses the slowdown?

Thanks for contributing.

danceOmatic_logo

Do you mind quantifying both the "running well" and the "very slow" part?

Nope I don't mind. I maybe just lack the skills :slight_smile:

The focus is on "Time between user interaction and visible response"

I ran some tests on how I serve my videos from backend to frontend.

//from backend
#[tauri::command]
pub fn get_video_path(handle: tauri::AppHandle, video_name: String) -> Result<String, String> {
    let start = std::time::Instant::now();
    let video_path = handle.path()
        .resolve(&format!("static/devVideo/{}", video_name), BaseDirectory::Resource)
        .map_err(|e| e.to_string())?;

        log::info!("my_command from tauri backend took {:?}", start.elapsed());

    video_path.to_str()
        .map(|s| s.to_string())
        .ok_or("Failed to convert path to string".to_string())
        
}

I took some time tests. But the videos [demo_videos] are not necessary visible (showing) within the time.
cargo tauri dev:

[2025-04-19][20:30:45][app_lib::commands][INFO] my_command from tauri backend took 56.875µs
[2025-04-19][20:30:46][app_lib::commands][INFO] my_command from tauri backend took 28.166µs
[2025-04-19][20:30:48][app_lib::commands][INFO] my_command from tauri backend took 56.708µs
[2025-04-19][20:30:49][app_lib::commands][INFO] my_command from tauri backend took 68.208µs
[2025-04-19][20:30:52][app_lib::commands][INFO] my_command from tauri backend took 76.292µs
[2025-04-19][20:30:53][app_lib::commands][INFO] my_command from tauri backend took 130.625µs
[2025-04-19][20:30:55][app_lib::commands][INFO] my_command from tauri backend took 37µs
[2025-04-19][20:30:57][app_lib::commands][INFO] my_command from tauri backend took 57.875µs
[2025-04-19][20:30:58][app_lib::commands][INFO] my_command from tauri backend took 39.25µs
[2025-04-19][20:31:00][app_lib::commands][INFO] my_command from tauri backend took 44.542µs

the average time taken by my_command in dev is approximately 59.5541µs.

tauri builded app (when the app is build):

[2025-04-19][20:25:28][app_lib::commands][INFO] my_command from tauri backend took 119.334µs
[2025-04-19][20:25:31][app_lib::commands][INFO] my_command from tauri backend took 93.792µs
[2025-04-19][20:25:32][app_lib::commands][INFO] my_command from tauri backend took 57µs
[2025-04-19][20:25:33][app_lib::commands][INFO] my_command from tauri backend took 115.667µs
[2025-04-19][20:25:34][app_lib::commands][INFO] my_command from tauri backend took 65.792µs
[2025-04-19][20:25:35][app_lib::commands][INFO] my_command from tauri backend took 139.334µs
[2025-04-19][20:25:38][app_lib::commands][INFO] my_command from tauri backend took 83.375µs
[2025-04-19][20:25:39][app_lib::commands][INFO] my_command from tauri backend took 252.5µs
[2025-04-19][20:25:40][app_lib::commands][INFO] my_command from tauri backend took 81.25µs
[2025-04-19][20:25:41][app_lib::commands][INFO] my_command from tauri backend took 233.709µs
[2025-04-19][20:25:42][app_lib::commands][INFO] my_command from tauri backend took 120.667µs
[2025-04-19][20:25:44][app_lib::commands][INFO] my_command from tauri backend took 127.125µs
[2025-04-19][20:25:45][app_lib::commands][INFO] my_command from tauri backend took 96.417µs
[2025-04-19][20:25:51][app_lib::commands][INFO] my_command from tauri backend took 105.083µs
[2025-04-19][20:25:53][app_lib::commands][INFO] my_command from tauri backend took 87.125µs
[2025-04-19][20:25:54][app_lib::commands][INFO] my_command from tauri backend took 118.708µs
[2025-04-19][20:25:54][app_lib::commands][INFO] my_command from tauri backend took 61.833µs

the average time taken by my_command in Build is approximately 109.8264µs.

Tell me you ran with --release.