Christoph wrote:

> The explanation is probably simpler -  f.extend(M) makes hook calls
to
> M.extend_object(f)  and M.extended(f) - M.extend_object(f)  probably
> tests if  f.is_a?(M) a - this means its 4 method calls, versus 1 call
+
> 1 if statement  ...
> you'll probably find a much smaller difference calling
> M.extend_object(f)  only.

You're right, of course. I would have noticed that had I actually taken
a look at the code instead of stating things from memory.

M.extend_object(f) doesn't call f.is_a?(M) though; module inclusion
uses its own specialized check. What surprised me a bit though is that
M.extended(f) is called each time, even when f is already extended with
M and is hence not extended again. We could save an extra method call
there (unless people rely on its being called every time Object#extend
is called) and get it down to 2 calls vs 1 call + 1 if statement.

Peter