Performance checkers: What tools are available for attaining the metrics necessary to perform a review? Bench-marking is often not easily done by hand after all.

This is a follow-up to this question about formatting and error checking tools.

Tools listed here should help getting metrics for questions with (info). Speed and time-complexity, memory usage, hang-ups, etc.

Preferably people should run these tools before posting their code on Code Review. However, since not everyone will follow this advice, feel free to use these tools in the reviewing process if required.

Post at least the name of the tool, the official website and the languages targeted by the tool. Free tools are preferred, make sure to add a note if your tool is paid/commercial.

Java

  • jmh

    JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targetting the JVM.

  • MicroBench

    Simpler microbenchmarks of Java8 code

  • caliper

    Caliper is Google's open-source framework for writing, running and viewing the results of JavaMicrobenchmarks.

Linux/Unix command line

The time command will give you a rough idea of execution time. See this SO answer for details and caveats.

Any running process on OS X can be tested using the Instruments application which comes with Xcode.

This is not limited to code that is written (or copy & pasted into) Xcode and compiled, built, run, etc., with Xcode. If it is a running process in OS X, Instruments can attach to it an analyze a ton of different metrics.

  • 1
    Instruments works for iOS apps as well, correct? – Flambino May 3 '15 at 23:47
  • 1
    As long as they are running in simulator or the device is plugged into USB. – nhgrif May 4 '15 at 0:15

Browsers

All the major, modern browsers come with a suite of developer tools, including profilers:

Python

timeit — built-in module for timing the execution of small bits of Python code. Start here! Many performance problems can be tackled using timeit and a willingness to experiment.

profile — built-in module for function-based deterministic profiling. Use this when your code is organized into functions and you're not sure which one is taking all the time.

line_profiler — package for line-by-line profiling. Try this if your code is not organized into functions, or if you tried profile and there was no clear culprit function.

benchmark — framework for writing benchmarks: like unittest but for performance tests rather than functionality tests.

Ruby

Included in Ruby's stdlib:

Gems:

  • ruby-prof is a pretty feature-rich profiler that can also benchmark memory usage and garbage collection.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .