1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/irb/cmd
aycabta 9f08e3c703 [ruby/irb] Add measure command
You can use "measure" command to check performance in IRB like below:

  irb(main):001:0> 3
  => 3
  irb(main):002:0> measure
  TIME is added.
  => nil
  irb(main):003:0> 3
  processing time: 0.000058s
  => 3
  irb(main):004:0> measure :off
  => nil
  irb(main):005:0> 3
  => 3

You can set "measure :on" by "IRB.conf[:MEASURE] = true" in .irbrc, and, also,
set custom performance check method:

  IRB.conf[:MEASURE_PROC][:CUSTOM] = proc { |context, code, line_no, &block|
    time = Time.now
    result = block.()
    now = Time.now
    puts 'custom processing time: %fs' % (Time.now - time) if IRB.conf[:MEASURE]
    result
  }

https://github.com/ruby/irb/commit/3899eaf2e2
2020-12-20 16:23:59 +09:00
..
chws.rb
fork.rb Revert "Prefer #send over #__send__ when it is clear there is no possible conflict" 2020-11-05 20:54:34 +09:00
help.rb irb/cmd/help.rb: return nil after the redefinition 2019-06-10 21:45:46 +09:00
info.rb [ruby/irb] Check existence of rc files in irb_info command 2020-04-29 19:13:14 +09:00
load.rb
measure.rb [ruby/irb] Add measure command 2020-12-20 16:23:59 +09:00
nop.rb
pushws.rb [ruby/irb] Discard newlines at end of file 2020-08-28 11:05:18 +09:00
subirb.rb