-
-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for benchmarking memory usage, etc. #86
Comments
Thank you very much for your feedback. This are valuable points, but I don't have any plans to extend this to memory profiling/benchmarking. I think this would turn That being said, I'm open to discuss this. |
I'm not sure of what @chrish42 had in mind, but peak memory usage is an interesting information. I'm not sure how to implement it, though. If someone gives me some pointers, I might give it a go. |
I tend to think this better left to (far more advanced) tools like valgrind. |
I'm going to close this, as I don't have any plans to include memory profiling. |
Since we use rusage.ru_maxrss I can try to bake a patch if adding this would be acceptable. |
It's not that easy.
|
The performance tools for windows have the same capabilities
It would be great to have.
I would add another (optional) line next to the timings.
I hadn't thought about this, probably a second set of files would be the easiest. |
It would be great to be able to optionally get peak RAM consumption. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm inclined to revisit this idea. Mostly because we now have the option of running commands without an intermediate shell (
See #321 for an earlier implementation of this feature. |
Valgrind does not support Windows or macOS. I would love for a portable tool like hyperfine to feature peak memory usage! The current workaround involves using |
I used that # Run hyperfine with output printed to the screen.
# In this example, we're just running it at 5 times minimum.
$ hyperfine --show-output -m 5 \
`# make a command with just ls` \
-n 'ls' \
`# run the time command and redirect ls output to /dev/null. But then redirect time output to stdout.` \
'/usr/bin/time ls -lh > /dev/null' 2>&1 | \
perl -lane '
# capture any maxresident integers
if(/(\d+)maxresident/){
# add the maxresident to time and increment the count for later average
$time += $1;
$num++
};
# If we see hyperfine output then print it untouched
if(/ Time| Range/){
print;
}
# When hyperfine is done, then average the memory and print it
END{
$avg = int($time/$num);
print "Avg memory: ${avg}k";
}'
Time (mean ± σ): 10.5 ms ± 4.7 ms [User: 2.0 ms, System: 7.9 ms]
Range (min … max): 6.0 ms … 63.6 ms 144 runs
Avg memory: 1441k |
I'd be interested in this too |
I came across this thread because I used hyperfine several times but now also need the peak memory usage for certain commands. Maybe it's a good alternative for some (like me) or serves as inspiration. |
Related:
|
In order to support the performance counters like On Linux we could access the perf counters either via perf-event2, on macos and windows we could look at what samply is doing and maybe try to use the smallest subset of it. |
This is definitely not in scope is hyperfine's goal is to be just a replacement for
time
, but the thing I most wish for when using time to benchmark programs is if it could measure other relevant program execution statistics, like memory usage. After all, optimization (which is what benchmarking is driving) is always about tradeoffs in some way. But it's kinda hard to know if you're making the right tradeoffs for your project if you're measuring only one thing (here, execution speed).Would something measuring memory usage, etc. that be in scope for hyperfine a a benchmarking tool?
The text was updated successfully, but these errors were encountered: