Recommended tools for benchmarking Ruby and Perl
Question: I want to compare the execution time for mathematical equations for different
dynamic, interpreted programming languages like Ruby, Perl, and Python.

In Python, there is the convenient `timeit` module, which allows me to time,
where I can simply time for, e.g., a least squares fit (`python_lstsqr(x,y)`)
via

    
    
    min(timeit.Timer('python_lstsqr(x, y)', 
                'from __main__ import python_lstsqr, x, y')\
                                            .repeat(repeat=3, number=1000))
    

(here the best of 3 repetitions and 1000 loops per repetition)

Are there equivalents in Perl and Ruby?


Answer: Good old `time` ?

For Perl, you can use built-in
[`Benchmark`](http://perldoc.perl.org/Benchmark.html) or
[`Time::Stopwatch`](https://metacpan.org/pod/Time%3a%3aStopwatch).

For Ruby, the built-in [`benchmark`](http://ruby-
doc.org/stdlib-2.1.2/libdoc/benchmark/rdoc/index.html) is good enough.

