Programming-Language-Benchmarks
Programming-Language-Benchmarks copied to clipboard
Use mimalloc in rust binarytree
I could not find a good general purpose allocator written in pure rust. But mimalloc, which is written in c, is really easy to use. It requires just two line to enable globally.
The check
function also takes self
by value, for another small improvement.
This helps because the deallocation can already be done inside check
.
@hanabi1224 what do you think?
FFI via non-stdlib is typically not accepted, or at least marked with -ffi suffix. In this case, I don't see how mimalloc
represents rust's unique value, other languages can easily use it as a drop-in replacement, that just end up measuring the libary itself, that's exactly why GMP usage via non-stdlib is not accepted here.
Hmm, why is FFI allowed in the stdlib but not in any other lib? This seems like an arbitrary distinction to me. In practice it should not matter if functionality is in the stdlib or a different lib as long as it is easy to use. This rules seems to just favour large stdlibs for no reason.
stdlib represents the unique value in the language, while arbitrary FFI usage does not. For all problems, people can build a dynamically linked lib from the fastest C program and use it in most of the languages via FFI, thus the results compare nothing but the FFI overhead, which is not what those problems are designed for.
This rules seems to just favour large stdlibs for no reason.
I don't think large stdlib are logically related to large FFI usage in stdlib
@hanabi1224 would this PR be acceptable if I made two versions?
-
6-ffi.rs
, which uses mimalloc -
6.rs
, which is pure rust
Oh the irony. Rust devs improving Rust benchmarks by using a library written in C. No shame.