contextfree / winrt-rust

Use and (eventually) make Windows Runtime APIs with Rust
Apache License 2.0
142 stars 10 forks source link

Benchmark (and potentially optimize) QueryInterface calls #35

Open Boddlnagg opened 7 years ago

Boddlnagg commented 7 years ago

Repeated calls to QueryInterface with the same parameters are guaranteed to return the same thing. The modern C++ projection uses a new compiler optimization to annotate the function as being pure so the compiler can eliminate such (virtual) calls that would otherwise have a high runtime overhead.

It is also explained here: https://www.youtube.com/watch?v=lm4IwfiJ3EU#t=50m03s

Maybe we can find (or build) a way to have the Rust compiler do a similar thing.