Socket
Book a DemoInstallSign in
Socket

pry-measure

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pry-measure

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

pry-measure

Adds pry-measure command for quick adhoc benchmarking.

Installation

gem install pry-measure

or added to the Gemfile:

gem 'pry-measure'

Helper methods

A pry_measure helper method is added which takes arguments for number of times to execute and number of times to run (defaults to 1 and 10, respectively):

pry(main)> pry_measure(2, 200000) do
pry(main)*   10.times do |time|; 1000*1000*1000*1000; end
pry(main)* end
       user     system      total        real
   0.230000   0.000000   0.230000 (  0.234847)
   0.230000   0.000000   0.230000 (  0.228060)
=> [#<Benchmark::Tms:0x007fd992bd2b30 ...>, #<Benchmark::Tms:0x007fd992bd2220 ...>]

Additionally, time_method is added:

pry(main)> time_method String, 'new', 'FooBar'
Time elapsed 0.004 milliseconds

Usage

pry-measure -t 10 #{`curl http://google.com`}

The above passes the interpolated code to Benchmark.measure to be evaluated 10 times. Upon completion the command returns a results hash with the average times:

=> {
  :real => 0.1958,
  :utime => 0.0,
  :stime => 0.002,
  :total => 0.056
}
pry-realtime #{`curl http://google.com`}
=> 0.6405

FAQs

Package last updated on 13 Jun 2015

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.