Hi I’m trying to evaluate multiple versions of a function on various datasets and record their peak memory behavior on these.
Optimally this would be a case of setting up each of the tests in a function and then running the program, something like:
let tester f = start test; ignore(f ()); end test
I’ve looked into Spacetime, however it seems to be a whole program memory profiler. The same goes for the majority of other profiling options.
Landmarks seems to be kind of what I’m looking however there were some concerns mentioned on reddit about its validity for profiling memory. Regardless it seems to use
Gc.allocated_bytes which from the documentation ignores whether the garbage collector has run and hence whether memory has been released.
I’ve also considered splitting each option into an individual program and then testing it manually, however that seems a bit overkill.
TL;DR: How does one get the peak memory usage of a function on a given input?