Open l0kod opened 9 years ago
I was a bit surprised that this isn't already done – especially in light of the fact that rust programs in publicized benchmarks appear to indulge in a bit more memory than corresponding C programs.
Looking at memory consumption is also usually the first thing I do when trying to optimize code, and if the runtime is similar, I will take the solution which uses less memory. Reducing memory usage can lead to performance benefits elsewhere because of cache effects.
By the way, jemalloc has the malloctl
function which allows to directly gather information of interest. je_malloc_stats_print
is meant to be readable to a human, and there is no guarantee on what format it will print.
Also hijacking this issue a bit, would it be feasible to include perf
counters in the benchmarking harness? Those may also show performance issues (e.g. cache misses, branch prediction misses, etc.) that the plain runtime cannot.
Memory would be nice. Then we can have teamcity service messages pushing out the stat so that it can be nicely graphed against commit history. (With #43381 )
I would love to see a PR to show memory usage information in #[bench].
Yup, this would be great.
Although since jemalloc usage is no longer universal, it would be a bit more difficult than it used to be.
Serve has a library for easy query of heap size at here (Though they have switched to an internal tool malloc_size_of
in the Servo project).
Jemalloc, which Rust uses by default, has support for monitoring memory usage.
I think it is a nice and feasible component to be added into the standard library, not only #[bench]
.
It would be nice to be able to see memory usage (and memory leak) in
#[bench]
tests to detect regressions. I guess jemalloc can do that with something likeje_malloc_stats_print
.cc #14119 cc #14875 cc #19776