Socket
Book a DemoInstallSign in
Socket

benchmark_unit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

benchmark_unit

0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

benchmark_unit

Machine-independent benchmark assertions for your unit tests.

== License

Copyright 2007 Cloudburst, LLC. See included LICENSE file.

The public certificate for this gem is at http://rubyforge.org/frs/download.php/25331/evan_weaver-original-public_cert.pem.

== Features

  • Test::Unit-compatible
  • machine-independent measurement units

== Installation

sudo gem install benchmark_unit

== Usage

First, require the library. Then, in a regular Test::Unit::TestCase, call either assert_faster or assert_slower. Pass a number of RubySeconds and a block to benchmark.

require 'benchmark/unit'

class MyTest < Test::Unit::TestCase

def test_speed_of_critical_method
  assert_faster(3) do
    MyCriticalMethod("data")
  end
end
  

end

You do not have to manually run the block multiple times; the library does that for you.

To find how many RubySeconds to start with, just omit the argument to the assert_faster or assert_slower call. The test will fail and report how long your block took. Add a little bit and use that as your initial failure point.

See Benchmark::RubySeconds for more details.

== Reporting problems

Patches and contributions are very welcome. Please note that contributors are required to assign copyright for their additions to Cloudburst, LLC.

FAQs

Package last updated on 25 Jul 2009

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.