[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: interesting links
> I'm not sure what the performance hit might be in removing it, and
> using a test on the object's type.
From a gcc developer's point of view...
A C++ method call off a pointer is two loads and an indirect call.
Three opcodes.
The "type" way is a load, compare, perhaps a switch statement (which
is an indirect jump), and a direct call.
You take a "big" hit for the compare/switch because it always checks
for out-of-bounds cases, so you end up with a lot of compares and
jumps, which are bad for performance.
Overall, not much difference, but C++ is a bit faster.
HOWEVER, from *our* point of view, it's looks like this:
Adding a new object in C++ means editing one file.
Adding a new object in C means editing *all* the files that have such
a compare/switch in them.
I've done this in PCB and it's a nightmare. Each time I do that, I
consider switching to C++ OOP. I suspect the maintenance payoff will
be very short.
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user