Performance characteristics of Ruby constructs


I’m right in the situation where I would like to find out some
performance characteristics for various parts of Ruby, to optimize an
application. Is there any resources available for this?

To make it concrete, let’s take two examples.

I’ve recently written a hybrid state-based, table-driven LL(1) parser,
where I gather productions (in the form of symbols) on a stack, and then
execute these with send(), until a get back the next terminal. This
works really great, but right now I’m wondering how cheap send() is,
compared to using a real table-driven approach.

Next example: there’s fairly heave use of Class#=== throughout the
application, and the profiler says I spend much time there. It’s a
fairly small class of Class comparisons I’m doing, though, so maybe it
would get me better performance by polluting the global namespace like
class Object
def __is_directive_token?; false; end
def __is_sequence_start_token?; false; end
class Token
class DirectiveToken
def __is_directive_token?; true; end
and just do tok.__is_directive_token? instead of DirectiveToken === tok.

Any thoughts in this? Is there any place to find general information
this, or I’m out in the wild right now?

Ola B.