3 ms·
http://benchmarksgame.alioth.debian.org/u64q/c.php http://benchmarksgame.alioth.debian.org/u64q/c.php Gives the indication that C++ is faster in practice only
by sharpneli 12y ago
http://benchmarksgame.alioth.debian.org/u64q/c.php http://benchmarksgame.alioth.debian.org/u64q/c.php
Gives the indication that C++ is faster in practice only when your algorithms are so complex that writing them in C starts to become tedious.
And frankly C++ can never match C until they introduce restrict. Only with C99 C was able to match Fortran. C++ does not have that luxury yet.
- TwoBit 12y agoWhat you say about restrict is hard to consider because every C++ compiler supports restrict. Also, I frequently see those types of algorithms that benefit C++. It's not just an STL thing.
- sharpneli 12y agoYeah it's true that restrict is well supported, mostly because all C++ compilers are also C compilers. Maybe the biggest reason why C++ is slower in practice is because the programmers tend to feel that using features unique to C++ almost mandatory. Even though technically the pure C program also compiles fine in C++.