Objects - Are they expensive?
Pretty cheap, in fact. C++ programming style encourages use of
many small functions but this does not incur a large performance
penalty because of function inlining.
Vector2 c3 = c1 + c2;
has no function call overhead in spite of the addition operator being
implemented as a function (see later).
It is hard to design good objects but once it is done
they are generally easy to use. Often, however, the objects you may want to
use already exist in libraries. Libraries are getting better all the time and
some are being designed specifically for HEP use.
Objects, like other structured data, make more efficient use of available
resources (less swapping, less trashing of the cache). Compare with FORTRAN
Because of the highly structured, strong-typed nature of C++, the
compiler/optimiser can often make stronger assumptions on how the data will
be manipulated and therefore optimise better than conventional languages.