What kind of code microprofiling/benchmarking software do you guys use? I was wondering if anyone knew of any that can also be used as a separate tool (open source preferred but I dont mind proprietary) rather than already integrated into something like Visual Studio.
Edit: I would like it to support Windows and Linux. I mostly program in C right now, but expanding into other languages (e.g., Rust, Python)
10 Comments
cecilkorik@lemmy.ca · 3 pts · 153d
I might be going the wrong direction of "micro" here but
timeis the very minimal, tiny, and traditional unix way.For example:
There are also a large number of other profiling outputs you can ask
timeto spit out by passing it the appropriate command line flags.steve_lebt_in_overflow@programming.dev · 1 pts · 153d
I'll look into using this in my workflow
entwine@programming.dev · 2 pts · 153d
There are a lot out there in C++ land, and I'm sure C has a lot too. You can't really go wrong with any if them tbh, just check if it has a lot of stars and go for it. I've used microprofile before and it served me well. You can view live data from an embedded webserver.
Perfetto is a powerful one from Google, but I've never used it.
Also, don't overlook gprof. That works via auto instrumentation done by the compiler, so it'll give you the most detailed look at performance with zero work from you (besides interpreting the sometimes massive amount of info)
steve_lebt_in_overflow@programming.dev · 2 pts · 153d
I'll look into it! gprof seems promising.
sacredfire@programming.dev · 2 pts · 151d
This may not fall under the umbrella of micro profiling, but I’ve using the cli tool perf a lot lately in Linux. Pretty powerful tool for performance profiling that can do active monitoring as well as take snapshots. Not sure about windows compatibility, maybe with wsl?
FizzyOrange@programming.dev · 2 pts · 153d
For benchmarking commands you can't beat hyperfine. But if you are really talking microbenchmarks you have to do that in-program so it'll depend on what language you're using.
E.g. for Rust Criterion is the go-to option.
tal@lemmy.today · 2 pts · 153d
For what platform?
steve_lebt_in_overflow@programming.dev · 1 pts · 153d
Updated my post. Windows + Linux
jubilationtcornpone@sh.itjust.works · 2 pts · 153d
If you want to do resource profiling, Visual Studio can do that out of the box. For simple benchmarking, specifically for seeing how long certain calls take, I just just the
Stopwatchclass and ouput the result to a log entry. Assuming you're using C# that is.Sxan@piefed.zip · 1 pts · 153d
hyperfine is pretty good for command line tools