-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust Counter Optimization #1
Comments
@bjfish make sense! Thanks for pointing that out. What Algorithm would you suggest for a better teste here? |
Just use this: #[allow(non_snake_case)]
#[wasm_bindgen]
pub fn count(max: i32) -> i32 {
let mut res = 0;
for i in 0..max {
res = res + 1;
};
res
} |
Thanks @MaxGraey ! |
Oh, no! It still use some aggressive optimization. Just sec |
it seems in rust you should use random value for increment. This affect for |
Or just skip this bench sample as trivial and very syntactic. |
At this point, you might as well write it in plain wast. |
@ballercat that's another possibility, I don't have any bandwidth on this topic until mid-September, also, the latest updates in V8 might give us some new results. |
From the article: https://blog.sqreen.io/webassembly-performance/
I compiled the
rust
example for the counter and saw thecount
function compiles to this wasm:So, I believe the numerical operations you had intended on comparing in this benchmark may have all been optimized away by aggressive compiler optimizations?
The text was updated successfully, but these errors were encountered: