9 ms·
I found the [picture](https://www.moonbitlang.cn/assets/images/image-1-41a71e74567c9a1e9d8965d812155e5d.png https://www.moonbitlang.cn/assets/images/image-1-41a
by slanterns 1y ago
I found the [picture](https://www.moonbitlang.cn/assets/images/image-1-41a71e74567c9a1e9d8965d812155e5d.png https://www.moonbitlang.cn/assets/images/image-1-41a71e74567...) in moonbit's [post](https://www.moonbitlang.cn/blog/moonbit-value-type https://www.moonbitlang.cn/blog/moonbit-value-type) which claim it is 33% faster is so misleading. The real reason for the performance difference has nothing to do with the code shown in the picture or "value types," but is the [memory allocation](https://github.com/moonbit-community/benchmark-fft/blob/8768668d2cc5d8c1ffbfc2a5b8c72068a1df3bd3/fft/rs/src/lib.rs#L66 https://github.com/moonbit-community/benchmark-fft/blob/8768...) in recursive function in their Rust code, while Moonbit is a managed language whose runtime [uses mimalloc by default](https://github.com/moonbit-community/benchmark-fft/issues/10 https://github.com/moonbit-community/benchmark-fft/issues/10). By simply [switching](https://github.com/CrazyboyQCD/benchmark-fft/pull/1 https://github.com/CrazyboyQCD/benchmark-fft/pull/1) Rust from system allocator to mimalloc as well, it'll just outperform Moonbit.