Seattle.rb: September 2010 Archives

zenprofiler helps answer WHAT is being called the most. spyon helps answer WHERE those calls are being made. ZenProfiler provides a faster version of the standard library ruby profiler. It is otherwise pretty much the same as before. spyon provides a clean way to redefine a bottleneck method so you can account for and aggregate all the calls to it.

% ruby -Ilib bin/zenprofile misc/factorial.rb 50000
Total time = 3.056884
Total time = 2.390000

          total     self              self    total
% time  seconds  seconds    calls  ms/call  ms/call  name
 50.70     1.64     1.64    50000     0.03     0.05 Integer#downto
 19.63     2.27     0.63   200000     0.00     0.00 Fixnum#*
 14.19     2.73     0.46    50000     0.01     0.05 Factorial#factorial
  9.93     3.05     0.32        1   320.36  3047.10 Range#each
  5.54     3.23     0.18        2    89.40   178.79 ZenProfiler#start_hook

Once you know that Integer#downto takes 50% of the entire run, you can use spy_on to find it. (See misc/factorial.rb for the actual code):

% SPY=1 ruby -Ilib misc/factorial.rb 50000
Spying on Integer#downto

Integer.downto

50000: total
50000: ./misc/factorial.rb:6:in `factorial' via 
       ./misc/factorial.rb:6:in `factorial'

Changes:

1.3.0 / 2010-09-02

Wraps rbaddeventhook so you can write fast ruby event hook processors w/o the speed penalty that comes with settrace_func (sooo sloooow!). Calls back into ruby so you don't have to write C.

% ruby demo.rb 
# of iterations = 1000000
                          user     system      total        real
null_time             0.120000   0.000000   0.120000 (  0.125279)
ruby time             0.560000   0.000000   0.560000 (  0.562834)
event hook            3.160000   0.010000   3.170000 (  3.175361)
set_trace_func       34.530000   0.100000  34.630000 ( 34.942785)

Changes:

1.1.0 / 2010-09-02

  • 2 minor enhancements:

    • Allow eventhookklass to work with class and metaclass.
    • Force ~/.ruby_inline cleanup in tests
  • 1 bug fix:

    • event_hook won't work on any 1.9 w/o major rework :(
  • http://rubyforge.org/projects/seattlerb

Hoe is a rake/rubygems helper for project Rakefiles. It helps you manage and maintain, and release your project and includes a dynamic plug-in system allowing for easy extensibility. Hoe ships with plug-ins for all your usual project tasks including rdoc generation, testing, packaging, and deployment.

See class rdoc for help. Hint: ri Hoe or any of the plugins listed below.

For extra goodness, see: http://seattlerb.rubyforge.org/hoe/Hoe.pdf

Changes:

2.6.2 / 2010-08-31

About this Archive

This page is a archive of entries in the Seattle.rb category from September 2010.

Seattle.rb: June 2010 is the previous archive.

Seattle.rb: November 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en