OO performance - inheritance

Posted by piret on 25-Mar-2014 13:45

I have measured the time it takes to create new objects that use inheritance in OE 11.3. I have not included the time to create the very first instance of the classes, as it takes considerably longer time. Here are the measurements in milliseconds:

I am using OE11.3

Is the creation of one object supposed to take such long time?

 

Here are the classes I used:

 

CLASS Test0:

END.

 

CLASS Test1 INHERITS Test0:

END.

CLASS Test2 INHERITS Test1:

END.

. . .

CLASS Test6 INHERITS Test5:

END.

 

Tests were run on linux:

model name : AMD Opteron(tm) Processor 6282 SE

cpu MHz: 2600.051

Architecture: x86_64

CPU(s): 4

Thanks

Posted by Thomas Mercer-Hursh on 25-Mar-2014 13:58

Looks pretty linear ... e.g., 2.5 ms for 1 and with 6 levels of inheritance you are instantiating 7 objects so 2.5 x 7 = 17.5 which is only slightly less than what you observed.  If you figure 2.5 to instantiate and .5 to link, you get 7 x 2.5 + 6 x .5 = 20.5 which is very close to what you measured.   Recognize that a fully compiled language will resolve the inheritance into a single executable but an interpreted one can't.  

And, of course, there are abundant comparisons of this type with Java which don't really mean anything in real applications.  How often do you instantiate 10,000 objects with 6 levels of inheritance?  And no contents! :)

All Replies

Posted by Thomas Mercer-Hursh on 25-Mar-2014 13:58

Looks pretty linear ... e.g., 2.5 ms for 1 and with 6 levels of inheritance you are instantiating 7 objects so 2.5 x 7 = 17.5 which is only slightly less than what you observed.  If you figure 2.5 to instantiate and .5 to link, you get 7 x 2.5 + 6 x .5 = 20.5 which is very close to what you measured.   Recognize that a fully compiled language will resolve the inheritance into a single executable but an interpreted one can't.  

And, of course, there are abundant comparisons of this type with Java which don't really mean anything in real applications.  How often do you instantiate 10,000 objects with 6 levels of inheritance?  And no contents! :)

Posted by ujj1 on 26-Mar-2014 09:21

Just as a side note:  Whenever you do benchmarking like this, if you use the -q parameter in your production environment, make sure to use that in your benchmark environment for your progress session.  -q is a performance tuning parameter which tells progress not to reread the .r file if it is still in memory from a prior read.  If you are benchmarking where you are creating the object in a loop to get an average instantiation time, -q should show a big improvement.

In some benchmarks I did a while back the difference between running with -q and not -q was something like 300 to 1.

In my case on my machine several years ago, object instantiation (an empty class, no inheritance) was about 3 ms where as with -q it was 0.01 ms.

This thread is closed