Project

General

Profile

Actions

Feature #4197

closed

Improvement of the benchmark library

Added by Eregon (Benoit Daloze) over 13 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
[ruby-core:33846]

Description

=begin
Hello Rubyists !

The Benchmark library's code is now becoming a bit old, and I would like to keep it up to date.

http://redmine.ruby-lang.org/wiki/ruby/Maintainers says there is no maintainer for lib/benchmark.
However, lib/benchmark.rb says it was created by Gotoken, and he made a commit on Feb 19, 2009.
The library has not been touched from 2004 (2002 for the code base), except for minor fixes.

I made several commits to clean the code, test it, watch it fail, and fix 2 minor bugs.
The commits are small, so feel free to discuss them separately.

You can see the commits here:
https://github.com/eregon/ruby/commits/benchmark

I did not modify the API, except Benchmark#benchmark's first parameter,
which do not need anymore to be manually padded with spaces:
Benchmark.benchmark(" "*7 + CAPTION, 7, ...
become
Benchmark.benchmark(CAPTION, 7, ...

(and Benchmark#bm now returns an Array of Benchmark::Tms times instead of STDOUT.sync)

I would like to improve Benchmark#bm, to not have to give the maximum label width, and let the library calculate it.
This will be part of another Feature request, to focus on cleaning code in this one.

This is my first direct contribution to Ruby, so please be indulgent.

If you are interested in some context about myself, please see [ruby-core:33845]

Merry Christmas !

Benoit Daloze
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0