4 ms·
There is a lot of crap in C++ which doesn't help with performance at all: class hierarchy with all the inheritance/friends/virtual/constructors/destructors, god
by bluecalm 13y ago
There is a lot of crap in C++ which doesn't help with performance at all: class hierarchy with all the inheritance/friends/virtual/constructors/destructors, godawful syntax, template model, exception handling, 101 ways to do the same thing, lack of package/module handling etc.
Rob Pike addresses those in the article.
Yes, Go is slower but it's not slower because of fixing those errors, it's slower because it introduces different features suitable for its niche (GC, reflection etc)
Rust takes similar approach to avoid C++ design mistakes and doesn't sacrifice performance in doing so.
Those mistakes (mainly the whole "object model" thing) is what he is saying in the article. Pointing out performance of Go isn't really an argument against his point.
- RogerL 13y agoTemplates do help with performance. Look up the performance characteristics of qsort (C) vs std::sort (templatized C++ sort).
- bluecalm 13y agoI tested both extensively lately and the performance was exactly the same (under Intel Compiler and Visual Studio) so probably those compilers found a way to optimize it. They both are much slower than hand coded version anyway so it doesn't really matter (link to implementation which beats standard qsort/std::sort performance by 2x/3x times (at least on my data): http://www.ucw.cz/libucw/doc/sort.html http://www.ucw.cz/libucw/doc/sort.html).