The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
BenchUnit?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
BenchUnit? Posted: Oct 30, 2005 9:38 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: BenchUnit?
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
I'm in the process of writing a hefty benchmark suite for Ruby. I'm doing this for several reasons - so we have a baseline to compare minor (or major) releases against each other, heavy iteration testing, checks for pathological slowdowns, and as a way to spot code we could optimize.

One of the things I'm discovering is that I'm constantly having to create a fresh instance of some object, then benchmarking against that object, to make sure I've got a "clean" object that wasn't affected by one of the other benchmarks. Sounds just like the scenario we have in testing, doesn't it? It's also annoying to constantly wrap everything in "MAX.times{ code_to_benchmark }".

It would be nice to have something like this:
class BC_Array < Bench::Unit::BenchCase
   def setup
      @max   = 100000
      @array = [1, "two", nil, true, 3]
   end

   def bench_clear
      @array.clear
   end

   def bench_concat
      @array.concat([1,2,3])
   end   

   def teardown
      @array = nil
   end
end

In this theoretical code, every method that started with "bench_" would be run as a benchmark, iterating "@max" times automatically, getting a new "@array" within each benchmark. I suppose you could create "bench runners" to format output and such as well.

So, who needs a task?

Read: BenchUnit?

Topic: How Rails is prepared for GWA II: Vengeance Previous Topic   Next Topic Topic: RubyConf.new(2005) Summary

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use