Closed NikVolf closed 2 years ago
AAIU bb_observe
is unnecessary, you can use any function that's unreadable by LLVM (including the test::black_box
function).
test::black_box
is it available in no-std?
I'm trying to work on a relatively-transparent benchmarking harness that compiles normal Rust benchmarks to a format that could work when compiled with wasm32-unknown-unknown
.
Implemented here
Great! Should we utilize it here, on the CI also?
I think so, although I'd have to make it work properly on test failure - i.e., report the actual reason for test failure. Currently I haven't implemented any of the exception mechanisms so the interpreter just panicks complaining about unimplemented functions.
We moved to Criterion based benchmarks that allow for more flexibility. I do not agree with a fixed benchmarking API as proposed in the initial comment since benchmarks are way too different to unify them under a single Wasm based API.
to address lack of benchmarks, we might want to use special wasm binaries which utilize specific benching api
it should consist of:
extern "C" fn start_bench(name_ptr: *const u8, name_len: u32)
)extern "C" fn start_iter()
)extern "C" fn end_iter()
)extern "C" fn bb_observe(ptr: *mut u8, len: u32)
) (can be replaced bytest::black_box
on nightly)each
start_iter
should followend_iter
sequentally so there should be no nested iterations or overlaps (higher-level utility library should enforce it via closures/ownership)bb_observe
is used to avoid compiler optimisations