Let us look at the overhead of calculation time caused by the object orientation. We first define some simple test methods and fields within a class hierarchy.
Next, we create objects to access the class members and check the evaluation.
We are now ready to test the access delay due to object or class access. All timings were obtained in
Mathematica 6.0.1 running in Mac OS X on a MacBook Pro with 2.2 GHz. All measurements are not fully reproducible and give a rough estimate about calculation times. Up to a factor of two in calculation times was observed between two identical inputs.
A public field is accessed faster than other class members. There are a few thousand accesses each second.
The access to a public method is slower.
Due to privilege checks, protected and private class members are slower in access.