Forum: Ruby event_hook 1.0.0 Released

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ryan D. (Guest)
on 2009-05-20 11:02
(Received via mailing list)
event_hook version 1.0.0 has been released!

* <http://rubyforge.org/projects/seattlerb>

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 (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.0.0 / 2009-05-19

* 1 major enhancement

   * Birthday!

* <http://rubyforge.org/projects/seattlerb>
Roger P. (Guest)
on 2009-05-20 16:37
> 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 (sooo
> sloooow!). Calls back into ruby so you don't have to write C.

Wow thanks for doing this--anybody know why rb_add_event_hook is so much
faster then?

A drop in replacement for set_trace_func might be sweet, too :)

-=r
Kent S. (Guest)
on 2009-05-20 17:23
(Received via mailing list)
On Wed, May 20, 2009 at 8:37 AM, Roger P. <removed_email_address@domain.invalid>
wrote:
>
>> 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 (sooo
>> sloooow!). Calls back into ruby so you don't have to write C.
>
> Wow thanks for doing this--anybody know why rb_add_event_hook is so much
> faster then?
>
> A drop in replacement for set_trace_func might be sweet, too :)
>

set_trace_func requires creating a new Binding object for each event
triggered. In Ruby 1.8.x this is very very slow operation. Ruby 1.9.x
reuses these Binding objects as much as possible, which makes this
operation much faster and lead to a way more acceptable speed of
debug.rb.
Ryan D. (Guest)
on 2009-05-21 05:04
(Received via mailing list)
On May 20, 2009, at 05:37 , Roger P. wrote:

>
>> 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 (sooo
>> sloooow!). Calls back into ruby so you don't have to write C.
>
> Wow thanks for doing this--anybody know why rb_add_event_hook is so
> much
> faster then?
>
> A drop in replacement for set_trace_func might be sweet, too :)

most of the cost is block activation.
This topic is locked and can not be replied to.