🕷 software projects

by ryan davis



sitemap

event_hook

Faster rb_event_hook support using simple ruby

** Note: ** This project is EOL’ed.

Wraps rb_add_event_hook so you can write fast ruby event hook processors w/o the speed penalty that comes with set_trace_func. Calls back into ruby so you don’t have to write C.

1
2
3
4
5
class SimpleTracer < EventHook
  self.process(*args)
    p args
  end
end
% 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)

Get The Code

If you just want to use event_hook, you can install it via RubyGems:
gem install event_hook
Fork me on GitHub If you want to hack on event_hook, clone it from GitHub:
git clone git://github.com/seattlerb/event_hook

Latest Activity