MATLAB: Do functions in MATLAB 7.8 (R2009a) execute faster than methods of objects for the same computation

classMATLABmcosoopperformance

I observe that code placed in a method of a class executes slower than the same code placed in a regular MATLAB function.

Best Answer

The ability to run methods of objects at the same speed as the functions is not available in MATLAB 7.8 (R2009a). This is because method calls and object property accesses have overhead which slow the execution of the class method call.
As a workaround, perform the operation in a normal function instead of in a object method call.