https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-12-27T14:56:54ZRuby Issue Tracking SystemRuby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=149082010-12-27T14:56:54Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>ko1 (Koichi Sasada)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=155062011-01-25T21:14:49ZEregon (Benoit Daloze)
<ul></ul><p>=begin<br>
Hi,</p>
<p>Any update on this ?</p>
<p>Could you have a look, Koichi ?</p>
<p>(Or anyone, I welcome comments)<br>
=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=155072011-01-25T22:05:08Zrkh (Konstantin Haase)me@rkh.im
<ul></ul><p>=begin<br>
This eases review: <a href="https://github.com/eregon/ruby/compare/trunk...benchmark" class="external">https://github.com/eregon/ruby/compare/trunk...benchmark</a></p>
<p>Konstantin</p>
<p>On Jan 25, 2011, at 13:14 , Benoit Daloze wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Improvement of the benchmark library (Closed)" href="https://redmine.ruby-lang.org/issues/4197">#4197</a> has been updated by Benoit Daloze.</p>
<p>Hi,</p>
<p>Any update on this ?</p>
<p>Could you have a look, Koichi ?</p>
<a name="Or-anyone-I-welcome-comments"></a>
<h2 >(Or anyone, I welcome comments)<a href="#Or-anyone-I-welcome-comments" class="wiki-anchor">¶</a></h2>
<p><a href="http://redmine.ruby-lang.org/issues/show/4197" class="external">http://redmine.ruby-lang.org/issues/show/4197</a></p>
<hr>
<p><a href="http://redmine.ruby-lang.org" class="external">http://redmine.ruby-lang.org</a></p>
</blockquote>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=155132011-01-26T09:53:34Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Assignee</strong> changed from <i>ko1 (Koichi Sasada)</i> to <i>naruse (Yui NARUSE)</i></li></ul><p>=begin<br>
Koichi said the lib is not his, so I reviewed it.</p>
<p>I almost accept your patch except following:</p>
<blockquote>
<p>4291a26b94a63e3066fe</p>
</blockquote>
<p>Tests for MRI should use test/unit.<br>
See also test files in test directory.</p>
<blockquote>
<p>f20763674b732b2734f9</p>
</blockquote>
<p>This introduces API change.<br>
Yeah, the change won't be a problem, but the rdoc must describe about its return value.<br>
attr_reader :list also should have the rdoc.<br>
=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=155332011-01-27T01:06:06ZEregon (Benoit Daloze)
<ul></ul><p>=begin<br>
Hi,</p>
<blockquote>
<p>Koichi said the lib is not his, so I reviewed it.</p>
</blockquote>
<p>Thank you.</p>
<blockquote>
<p>I almost accept your patch except following:</p>
<blockquote>
<p>4291a26b94a63e3066fe</p>
</blockquote>
<p>Tests for MRI should use test/unit.</p>
</blockquote>
<p>I thought minitest/spec were fine, as it is in the standard library (and the fact test/unit is now a compatibility layer using minitest/unit).<br>
fiddle, minitest, net/smtp, psych, rdoc and rubygems use minitest (according to $ grep -r minitest test).<br>
But only minitest/spec's tests use minitest/spec.</p>
<p>I also understood in <a href="https://blade.ruby-lang.org/ruby-core/32280">[ruby-core:32280]</a>, that minitest/spec was accepted (but not rspec/mspec of course, because they are not bundled).</p>
<p>I can change to (mini)test/unit if you want.</p>
<blockquote>
<p>See also test files in test directory.</p>
</blockquote>
<p>Do you mean another file than test/benchmark/test_benchmark.rb ?<br>
I included that test in mine, as I thought it would be better to merge all tests together.<br>
(The code is not so similar as there is no assert_nothing_raised in minitest)</p>
<blockquote>
<blockquote>
<p>f20763674b732b2734f9</p>
</blockquote>
<p>This introduces API change.<br>
Yeah, the change won't be a problem, but the rdoc must describe about its return value.<br>
attr_reader :list also should have the rdoc.</p>
</blockquote>
<p>Sorry, I forgot about it.<br>
It is fixed in 227034b9 lib/benchmark: document the return value of #benchmark and the :list attribute in Report</p>
<p>P.S.:<br>
Git sha are not so handy to describe a commit, maybe the description is better (especially if the history is rewritten).</p>
<p>May I assign to you further benchmark issues ?<br>
=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156292011-02-01T01:17:05Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
This issue was solved with changeset r30747.<br>
Benoit, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>
<p>lib/benchmark.rb: fix benchmarck to work with current ruby.<br>
patched by Benoit Daloze <a href="/issues/4197">[ruby-core:33846]</a> <a href="/issues/4341">[ruby-dev:43143]</a><br>
merged from <a href="https://github.com/eregon/ruby/commits/benchmark" class="external">https://github.com/eregon/ruby/commits/benchmark</a></p>
</li>
<li>
<p>lib/benchmark (Report#width): update documentation</p>
</li>
<li>
<p>lib/benchmark: document the return value of #benchmark and the<br>
:list attribute in Report</p>
</li>
<li>
<p>lib/benchmark (Tms#format): rename variables, use String#%<br>
instead of Kernel.format</p>
</li>
<li>
<p>lib/benchmark: remove undocumented Benchmark::times (an alias<br>
of Process::times used twice)</p>
</li>
<li>
<p>lib/benchmark (#benchmark): use label_width for the caption</p>
</li>
<li>
<p>lib/benchmark (Tms#initialize): rename variables</p>
</li>
<li>
<p>lib/benchmark: allow title to not be a String and call #to_s</p>
</li>
<li>
<p>lib/benchmark (Benchmark#bm): return an Array of the times with<br>
the labels</p>
</li>
<li>
<p>lib/benchmark: correct output for Benchmark#bmbm<br>
(remove the extra space)</p>
</li>
<li>
<p>lib/benchmark: add a few tests for Benchmark::Tms output</p>
</li>
<li>
<p>lib/benchmark: improve style (enumerators, ljust, unused vars)</p>
</li>
<li>
<p>lib/benchmark: add spec about output and return value</p>
</li>
<li>
<p>lib/benchmark: improve basic style and consistency<br>
no parenthesis for print and use interpolation instead of printf</p>
</li>
<li>
<p>lib/benchmark: remove unnecessary conversions and variables</p>
</li>
<li>
<p>lib/benchmark: correct indentation</p>
</li>
<li>
<p>lib/benchmark: rename the FMTSTR constant and variable to FORMAT</p>
</li>
<li>
<p>lib/benchmark: remove useless exception</p>
</li>
<li>
<p>test/benchmark: remove unused variable warnings<br>
=end</p>
</li>
</ul> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156322011-02-01T13:39:16Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>=begin<br>
Hi</p>
<blockquote>
<ul>
<li>
<p>lib/benchmark.rb: fix benchmarck to work with current ruby.<br>
patched by Benoit Daloze <a href="/issues/4197">[ruby-core:33846]</a> <a href="/issues/4341">[ruby-dev:43143]</a><br>
merged from <a href="https://github.com/eregon/ruby/commits/benchmark" class="external">https://github.com/eregon/ruby/commits/benchmark</a></p>
</li>
<li>
<p> lib/benchmark (Report#width): update documentation</p>
</li>
<li>
<p> lib/benchmark: document the return value of #benchmark and the<br>
:list attribute in Report</p>
</li>
<li>
<p> lib/benchmark (Tms#format): rename variables, use String#%<br>
instead of Kernel.format</p>
</li>
<li>
<p> lib/benchmark: remove undocumented Benchmark::times (an alias<br>
of Process::times used twice)</p>
</li>
<li>
<p> lib/benchmark (#benchmark): use label_width for the caption</p>
</li>
<li>
<p> lib/benchmark (Tms#initialize): rename variables</p>
</li>
<li>
<p> lib/benchmark: allow title to not be a String and call #to_s</p>
</li>
<li>
<p> lib/benchmark (Benchmark#bm): return an Array of the times with<br>
the labels</p>
</li>
<li>
<p> lib/benchmark: correct output for Benchmark#bmbm<br>
(remove the extra space)</p>
</li>
<li>
<p> lib/benchmark: add a few tests for Benchmark::Tms output</p>
</li>
<li>
<p> lib/benchmark: improve style (enumerators, ljust, unused vars)</p>
</li>
<li>
<p> lib/benchmark: add spec about output and return value</p>
</li>
<li>
<p> lib/benchmark: improve basic style and consistency<br>
no parenthesis for print and use interpolation instead of printf</p>
</li>
<li>
<p> lib/benchmark: remove unnecessary conversions and variables</p>
</li>
<li>
<p> lib/benchmark: correct indentation</p>
</li>
<li>
<p> lib/benchmark: rename the FMTSTR constant and variable to FORMAT</p>
</li>
<li>
<p> lib/benchmark: remove useless exception</p>
</li>
<li>
<p> test/benchmark: remove unused variable warnings</p>
</li>
</ul>
</blockquote>
<p>The change log says, test/benchmark has been changed only warnings issue<br>
by this commit. However it has more widely change and it made a false positive<br>
test failure on windows.</p>
<ol>
<li>Failure:<br>
test_0001__ruby_dev_40906_can_add_in_place_the_time_of_execution_of_the_block_gi<br>
ven(Benchmark::Bugs) [C:/ruby/trunk/test/benchmark/test_benchmark.rb:127]:<br>
Expected 0.0 to not be equal to 0.</li>
</ol>
<p>Therefore, I commited following additional patch.<br>
Thanks.</p>
<p>===================================================================<br>
--- ChangeLog (revision 30752)<br>
+++ ChangeLog (working copy)<br>
@@ -1,3 +1,10 @@<br>
+Tue Feb 1 13:20:39 2011 KOSAKI Motohiro <a href="mailto:kosaki.motohiro@gmail.com" class="email">kosaki.motohiro@gmail.com</a><br>
+</p>
<ul>
<li>
<pre><code> * test/benchmark/test_benchmark.rb (#capture_bench_output):
</code></pre>
</li>
<li>
<pre><code> Added explict sleep. Windows have imprecise time support.
</code></pre>
</li>
<li>
<pre><code> Thus Tms.new.Add!{} may be or may be not equal 0.
</code></pre>
</li>
<li>
<pre><code> The test failure started since r30747.
</code></pre>
</li>
<li>
</ul>
<p>Tue Feb 1 11:03:47 2011 Ryan Davis <a href="mailto:ryan@lust.local" class="email">ryan@lust.local</a></p>
<pre><code> * lib/rubygems*: Import rubygems 1.5.0 (released version @ 1fb59d0)
</code></pre>
<a name="Index-testbenchmarktest_benchmarkrb"></a>
<h1 >Index: test/benchmark/test_benchmark.rb<a href="#Index-testbenchmarktest_benchmarkrb" class="wiki-anchor">¶</a></h1>
<p>--- test/benchmark/test_benchmark.rb (revision 30752)<br>
+++ test/benchmark/test_benchmark.rb (working copy)<br>
@@ -123,7 +123,7 @@<br>
it '<a href="https://blade.ruby-lang.org/ruby-dev/40906">[ruby-dev:40906]</a> can add in-place the time of execution of the block gi<br>
ven' do<br>
t = Benchmark::Tms.new<br>
t.real.must_equal 0</p>
<ul>
<li>
<pre><code> t.add! {}
</code></pre>
</li>
</ul>
<ul>
<li>
<pre><code> t.add! { sleep 0.1 }
t.real.wont_equal 0
</code></pre>
end<br>
end</li>
</ul>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156652011-02-04T01:49:13ZEregon (Benoit Daloze)
<ul></ul><p>=begin<br>
Hi,<br>
On 1 February 2011 05:38, KOSAKI Motohiro <a href="mailto:kosaki.motohiro@gmail.com" class="email">kosaki.motohiro@gmail.com</a> wrote:</p>
<blockquote>
<p>Hi</p>
<p>The change log says, test/benchmark has been changed only warnings issue<br>
by this commit. However it has more widely change and it made a false positive<br>
test failure on windows.</p>
</blockquote>
<p>Sorry, I forgot about windows' imprecision.</p>
<p>I intended to do a sleep(), but did not want to slow down the test and<br>
thought just running the block was enough.</p>
<p>Thanks for the patch.</p>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156692011-02-04T12:24:13Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>=begin<br>
2011/2/4 Benoit Daloze <a href="mailto:eregontp@gmail.com" class="email">eregontp@gmail.com</a>:</p>
<blockquote>
<p>Hi,<br>
On 1 February 2011 05:38, KOSAKI Motohiro <a href="mailto:kosaki.motohiro@gmail.com" class="email">kosaki.motohiro@gmail.com</a> wrote:</p>
<blockquote>
<p>Hi</p>
<p>The change log says, test/benchmark has been changed only warnings issue<br>
by this commit. However it has more widely change and it made a false positive<br>
test failure on windows.</p>
</blockquote>
<p>Sorry, I forgot about windows' imprecision.</p>
<p>I intended to do a sleep(), but did not want to slow down the test and<br>
thought just running the block was enough.</p>
<p>Thanks for the patch.</p>
</blockquote>
<p>No problem. :)<br>
At minimum, your code is very clean and good readable. therefore I could find<br>
the test failure reason and fix it quickly.</p>
<p>Thank you too.</p>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156862011-02-06T00:08:21Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul></ul><p>=begin<br>
Hi,<br>
In Benchmark#bmbm, I think it's better to use ensure clause instead of Object#tap to restore STDOUT.sync. How about a patch below?</p>
<p>diff --git a/lib/benchmark.rb b/lib/benchmark.rb<br>
index 052b9ad..ac17ba4 100644<br>
--- a/lib/benchmark.rb<br>
+++ b/lib/benchmark.rb<br>
@@ -266,9 +266,9 @@ module Benchmark<br>
GC.start<br>
print label.ljust(width)<br>
Benchmark.measure(&item).tap { |res| print res.format }</p>
<ul>
<li>}.tap {</li>
<li>
<pre><code> STDOUT.sync = sync
</code></pre>
}</li>
</ul>
<ul>
<li>ensure</li>
<li>STDOUT.sync = sync unless sync.nil?<br>
end</li>
</ul>
<pre><code>#
</code></pre>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156872011-02-06T03:38:44ZEregon (Benoit Daloze)
<ul></ul><p>=begin<br>
Hi,<br>
On 5 February 2011 16:08, Tomoyuki Chikanaga wrote:</p>
<blockquote>
<p>Hi,<br>
In Benchmark#bmbm, I think it's better to use ensure clause instead of Object#tap to restore STDOUT.sync.</p>
</blockquote>
<p>Do you have a particular scenario in mind ?<br>
(If it is an Interrupt, I think restoring STDOUT's sync is not relevant.)</p>
<p>#tap is used to return the list of the Benchmark::Tms.<br>
So, your patch would need to store that list in a variable, and return it.</p>
<p>Also, sync would never be nil without ensure.<br>
This extra check shows "ensure" is complicating things in this case.<br>
So, I think it is overkill to use ensure here.</p>
<p>On IO#sync's subject, I thought once it would be nice to have a block form of IO#sync, which could use ensure.</p>
<p>Anyway, I am going to propose to move that print behavior in Report/Job, and I will probably use IO#flush, to make things simpler.<br>
=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=156892011-02-06T11:07:22Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
Hi,</p>
<p>At Sun, 6 Feb 2011 03:38:48 +0900,<br>
Benoit Daloze wrote in <a href="https://blade.ruby-lang.org/ruby-core/35103">[ruby-core:35103]</a>:</p>
<blockquote>
<p>(If it is an Interrupt, I think restoring STDOUT's sync is not relevant.)</p>
</blockquote>
<p>A library should not leave such globally shared states changed.</p>
<blockquote>
<p>#tap is used to return the list of the Benchmark::Tms.<br>
So, your patch would need to store that list in a variable, and return it.</p>
</blockquote>
<p>`ensure' clause does not affect the return value.<br>
So tap trick is not needed here.</p>
<blockquote>
<p>Also, sync would never be nil without ensure.<br>
This extra check shows "ensure" is complicating things in this case.<br>
So, I think it is overkill to use ensure here.</p>
</blockquote>
<p>Consider the case interrupted during `yield'.</p>
<blockquote>
<p>On IO#sync's subject, I thought once it would be nice to have a block form of IO#sync, which could use ensure.</p>
</blockquote>
<p>It's another story, please file new ticket.</p>
<p>--<br>
Nobu Nakada</p>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=157092011-02-06T23:19:08Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul></ul><p>=begin<br>
Hi,</p>
<p>Well, Nakada-san already said almost all my points.</p>
<blockquote>
<p>Anyway, I am going to propose to move that print behavior in Report/Job, and I will probably use IO#flush, to make things simpler.<br>
I see. It's better than change STDOUT.sync because of less side effects.<br>
I withdraw my previous patch.<br>
thanks.<br>
=end</p>
</blockquote> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=157102011-02-06T23:36:31Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>=begin</p>
<blockquote>
<p>Hi,</p>
<p>Well, Nakada-san already said almost all my points.</p>
<blockquote>
<p>Anyway, I am going to propose to move that print behavior in Report/Job, and I will probably use IO#flush, to make things simpler.<br>
I see. It's better than change STDOUT.sync because of less side effects.<br>
I withdraw my previous patch.<br>
thanks.</p>
</blockquote>
</blockquote>
<p>I agree.<br>
Anyway, your patch is nicer than current. I hope you will commit it.</p>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=157112011-02-07T01:32:36ZEregon (Benoit Daloze)
<ul></ul><p>=begin<br>
Hi,<br>
On 6 February 2011 03:07, Nobuyoshi Nakada wrote:</p>
<blockquote>
<p>Hi,</p>
<p>A library should not leave such globally shared states changed.</p>
</blockquote>
<p>I know, that is why I prefer to use IO#flush in libraries.</p>
<blockquote>
<p>`ensure' clause does not affect the return value.<br>
So tap trick is not needed here.</p>
</blockquote>
<p>My mistake, I did not know `ensure' clause preserve the return value.<br>
That's definitely handful.</p>
<p>I guess then the patch is fine.</p>
<p>Tomoyuki: Please commit it (if you want), that will clean that part until I work on it.</p>
<blockquote>
<blockquote>
<p>On IO#sync's subject, I thought once it would be nice to have a block form of IO#sync, which could use ensure.</p>
</blockquote>
<p>It's another story, please file new ticket.</p>
</blockquote>
<p>I now think it is not a good idea, giving it is probably best not to use IO#sync in a library.<br>
=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=168032011-05-08T22:57:06Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>=begin<br>
Hi, Benoit.<br>
How about following skipped test?</p>
<pre><code>it 'correctly guess the label width even when not given' do
skip :not_implemented
capture_bench_output(:bm).must_equal BM_OUTPUT
end
</code></pre>
<p>=end</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=168092011-05-09T00:19:35ZEregon (Benoit Daloze)
<ul></ul><p>Hello,</p>
<p>I said I would soon make it pass, but I unfortunately did not take the time yet to report the feature, I'm sorry.</p>
<p>However, the code is already there, I just need to split it correctly into commits.<br>
Also, I believe my code should be discussed because there are alternatives.</p>
<p>If that skip is bothering you, please feel free to comment or even remove that test.<br>
I'll try to report the feature this week.</p> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=168122011-05-09T00:23:54Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>naruse (Yui NARUSE)</i> to <i>Eregon (Benoit Daloze)</i></li></ul> Ruby master - Feature #4197: Improvement of the benchmark libraryhttps://redmine.ruby-lang.org/issues/4197?journal_id=186172011-06-28T15:09:48Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>This issue was solved with changeset r32269.<br>
Benoit, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>
<p>lib/benchmark.rb: merge eregon/benchmark.<br>
<a href="https://github.com/eregon/ruby/tree/benchmark" class="external">https://github.com/eregon/ruby/tree/benchmark</a><br>
patched by Benoit Daloze. <a href="/issues/4940">[ruby-core:37593]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Fixes for the benchmark library (Closed)" href="https://redmine.ruby-lang.org/issues/4940">#4940</a>]</p>
</li>
<li>
<p>lib/benchmark (Benchmark#bmbm): bmbm should be consistent with bm<br>
for the return value.</p>
</li>
<li>
<p>test/benchmark: remove preemptive test instead of skipping<br>
I removed the preemptive test I wrote for Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Improvement of the benchmark library (Closed)" href="https://redmine.ruby-lang.org/issues/4197">#4197</a>.<br>
I'll add it back when the implementation will be able to satisfy it.</p>
</li>
<li>
<p>lib/benchmark (Benchmark#bmbm): remove useless explicit call,<br>
#format is an alias of #to_s test/benchmark: add a test for<br>
format of long time.</p>
</li>
<li>
<p>lib/benchmark: fix label width: always add 1 to ensure there is a<br>
space delimiter even with times over 100s<br>
When I asked for Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Improvement of the benchmark library (Closed)" href="https://redmine.ruby-lang.org/issues/4197">#4197</a>, I wanted to make delimiting spaces<br>
consistent for #bm and #bmbm.<br>
But with times over 100s, the output contains no space between the<br>
label and the first time (user).<br>
Now both ensure there is always a space, even if that means 3 spaces<br>
with times under 10s (because it is formatted as %10.6f)</p>
</li>
<li>
<p>test/benchmark: let labels be a constant<br>
lib/benchmark (Benchmark#realtime): avoid creating an unused Proc<br>
lib/benchmark (Benchmark#benchmark): use ensure clause to restore<br>
STDOUT.sync, as in #bmbm</p>
</li>
</ul>