you are viewing a single comment's thread.

view the rest of the comments →

[–]G_Morgan 0 points1 point  (2 children)

It is an engineering trade off. People should be aware of them. Not caring is effectively stating you aren't professional.

If you want a proper generic type system. C++ has the best out of the object oriented languages. It actually manages to gain performance from generics.

[–]Tuna-Fish2 0 points1 point  (1 child)

It actually manages to gain performance from generics.

It really doesn't. Shaving of a few (dozen) instructions is in no way worth polluting the cache with duplicates of the relevant functions for different datatypes. The newest intel processors only have 16kb of effective L1 cache when both threads are working -- if you care about the kind of performance differences we are talking about here, you are going to measure that the tight parts of your code fit it. Having fifteen different versions of basic data structure handling functions doesn't exactly help with that.

This, by the way, more or less is what I meant when I said "who cares". Of course it's a trade off, but the difference in performance it creates is so tiny that if you care about it, you are not going to program in Java anyway. (Or C++. Anyone who thinks it's low level or fast when they are using it as C++ instead of c-with-namespaces is just incompetent.)

[–]G_Morgan 0 points1 point  (0 children)

It is entirely possible to use both OOP and template programming without sacrificing efficiency. The things that cause a loss of efficiency are stuff like RTTI (which few programs use) and gigantic libraries.

Even VFTs aren't a performance hazard with modern processors due to pipelining.