ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
14.99k stars 772 forks source link

Profile-Guided Optimization (PGO) on Ruffle #12094

Open zamazan4ik opened 11 months ago

zamazan4ik commented 11 months ago

Hi!

Did anyone try before applying Profile-Guided Optimization (PGO) on Ruffle? I can expect that this optimization can reduce CPU usage for the project (since it helps to a lot of software, including Rust-based). Even if FPS will not increase - reduced CPU usage is a nice thing to have. But honestly, according to my tests even FPS can be improved in similar workloads (I did it with PDOed Cemu and CPU render).

If anyone already tried to do something similar - please share your results.

Thanks in advance!

desertking commented 11 months ago

I don't have insights in what this is. Is it something that only can be done when creating the ,wasm files?

zamazan4ik commented 11 months ago

PGO is an optimization technique of the program itself based on runtime characteristics. You can optimize the Ruffle interpreter with that. Since Ruffle is written in Rust, I suggest you try to follow cargo-pgo guide: https://github.com/Kobzol/cargo-pgo

The algorithms usually is the following:

Many of these steps are pretty automatic with cargo-pgo.

desertking commented 11 months ago

Okay I'm not a developer of Ruffle. So it's nothing I could do on my server-side when hosting ruffle via wasm. So far the devs did not care too much about the performance but I guess it becomes more and more critical. Maybe some other dev here is interested in having a look into it sooner or later, I hope.