On Jun 23, 2007, at 10:28 AM, John Joyner wrote:

> John N. Joyner wrote:
>> Is there a significant performance difference between these two  
>> ways to
>> call a method?
>> (a) Define the method in a module, then call it with
>> MODULE_NAME::METHOD_NAME
>> (b) Define the method in a class, then instantiate an object from the
>> class, then call the method with OBJECT_REFERENCE_VAR.METHOD_NAME
>>
>> Purely for the convenience in naming methods, I'd love to do  
>> everything
>> in classes,

IMO that's not a good reason. The main reason for grouping methods  
into classes is to provide behavior to a set of objects where each  
object maintains it own individual state. Another is that classes  
support inheritance and modules don't. In particular, every class you  
define inherits great deal of commonly needed behavior from Object.

Also, I don't see why naming is more convenient in classes than in  
modules.

>> but I can't help suspecting that performance will suffer
>> somewhat if I instantiate objects when not really necessary.

If you suspect this, test your hypothesis with the Benchmark library.

> Apologies! I had meant to start a new thread.

Regards, Morton