# Benchmark Suggestions

**URL:** <https://www.ruby-forum.com/t/benchmark-suggestions/260884>\
**Category:** Development\
**Created:** [January 30, 2021, 3:25am UTC](https://www.ruby-forum.com/t/benchmark-suggestions/260884 "2021-01-30T03:25:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keithrbennett](https://www.ruby-forum.com/user_avatar/www.ruby-forum.com/keithrbennett/32/1341_2.png) [@keithrbennett](https://www.ruby-forum.com/u/keithrbennett)\
**Post date:** [January 30, 2021, 3:25am UTC](https://www.ruby-forum.com/t/benchmark-suggestions/260884/1 "2021-01-30T03:25:31Z")

</div>

Hello, I’ve posted a couple of issues and a pull request on the Github `benchmark` repo, Is that the right place to post them? Should they be discussed here as well? They are:

> <https://github.com/ruby/benchmark/issues/3>
>
> \`Benchmark::Tms\` contains a \`to\_a\` method, but a \`to\_h\` method would also be use…ful. I added a \`to\_h\` method, and a test for it.
> 
> When running the test, I found that the test was loading the benchmark code from the Ruby runtime (using \`require benchmark\`), so my code changes were ignored. The PR for this issue addresses this by using \`require\_relative\` instead.

> <https://github.com/ruby/benchmark/issues/5>
>
> For methods that print to standard output (\`benchmark\`, \`bm\`, and \`bmbm\`), it wo…uld be nice to be able to specify that they go to another stream instead, such as an open file or a string buffer (\`StringIO\`), or even \`$stdout\`, in case it has been changed to something other than \`STDOUT\`.
> 
> In cases where the method signature would not support another parameter, an alternate method could be added in which the stream is a parameter, the body of the original method moved there, and the original method remaining to call the new method with \`STDOUT\`, e.g.:
> 
> \`\`\`
> def benchmark(caption = "", label\_width = nil, format = nil, \*labels)
> ...
> end
> \`\`\`
> 
> ...could become...
> 
> 
> \`\`\`
> def benchmark\_to(output\_stream, caption = "", label\_width = nil, format = nil, \*labels)
> # body of original benchmark method
> end
> \`\`\`
> 
> ...and...
> 
> \`\`\`
> def benchmark(caption = "", label\_width = nil, format = nil, \*labels)
> benchmark\_to(STDOUT, caption, label\_width, format, \*labels)
> end
> \`\`\`
> 
> I believe all the likely objects for output would support \`puts\`, \`print\`, etc. I'm not sure about \`sync\`, but I suppose we could put a \`respond\_to?\` guard around that call.

> <https://github.com/ruby/benchmark/pull/4>
>
> Adds a \`to\_h\` method to Benchmark::Tms.
> 
> Fixes the test file's \`require\` to lo…ad the code in the modified benchmark.rb instead of the Ruby distribution.
