Programming-Language-Benchmarks icon indicating copy to clipboard operation
Programming-Language-Benchmarks copied to clipboard

Use mimalloc in rust binarytree

Open LHolten opened this issue 2 years ago • 5 comments

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?

LHolten avatar Apr 21 '22 14:04 LHolten

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.

hanabi1224 avatar Apr 21 '22 15:04 hanabi1224

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.

LHolten avatar Apr 21 '22 17:04 LHolten

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 avatar Apr 22 '22 04:04 hanabi1224

@hanabi1224 would this PR be acceptable if I made two versions?

  • 6-ffi.rs, which uses mimalloc
  • 6.rs, which is pure rust

LHolten avatar Apr 25 '22 09:04 LHolten

Oh the irony. Rust devs improving Rust benchmarks by using a library written in C. No shame.

HFTrader avatar Mar 06 '24 17:03 HFTrader