apache / opendal

Apache OpenDAL: One Layer, All Storage.
https://opendal.apache.org
Apache License 2.0
3.45k stars 482 forks source link

bug: cpu work in ops benchmark of core is optimized out #5075

Open NKID00 opened 2 months ago

NKID00 commented 2 months ago

Describe the bug

The following code in bench_read_parallel is optimized out before benchmark:

https://github.com/apache/opendal/blob/e869a70a63c0e6ccaaeabe7678ec77ecd614f5ac/core/benches/ops/read.rs#L98-L103

Steps to Reproduce

The entire loop is optimized out in emitted llvm ir displayed using cargo-show-asm:

cargo asm -p opendal --bench ops --features tests --release --llvm ops::read::bench_read_parallel 12

Expected Behavior

This piece of code should not be optimized out.

Additional Context

No response

Are you willing to submit a PR to fix this bug?