News for hackers. Stuff that matters.
Re:Should C Programmers Learn C++, Go or Rust? (2018) by ncmncm on Tuesday May 07, 2019 @12:33AM (#19846615)
It is not unusual for a C++ or Rust program to be 30% faster than the C program it replaces. The reasons are worth studying.

30% may be no great shakes vs the 1000%+ available switching from Python, but in this post-Moore's-Law world, it is nothing to sneeze at.

Re:Should C Programmers Learn C++, Go or Rust? (2018) by Zelizz on Tuesday May 07, 2019 @04:32PM (#19853178)
I think it’s not unusual for any program to be 30% faster than the program it replaces. So far I haven’t seen any specific examples of the C++ or Rust compiler providing a speedup by leveraging additional information input by the programmer. The main speedup seems to be the ability to easily implement more complicated algorithms, and the ability to speedily replace slow one-off implementations with relatively high-quality standard library ones.
Re:Should C Programmers Learn C++, Go or Rust? (2018) by ncmncm on Tuesday May 07, 2019 @07:46PM (#19854550)
Yes, the practicality of dropping in use of a well-optimized library is one of the ways that C++ code often beats C.

Another is the ability to pass a lambda to library function, and compiled directly into it, where C would need to pass a pointer-to-function to be called indirectly.

Both contribute to the showcase sorting example, which is used frequently because it had proven to be understandable, not because it is unique.

Re:Should C Programmers Learn C++, Go or Rust? (2018) by dvhh on Tuesday May 07, 2019 @05:19AM (#19847754)
My guess is that these languages (C++, Rust) allow for far more optimizations as it is quite discouraged to reinvent the wheel.

Which is a unfortunately a thing in C

Re:Should C Programmers Learn C++, Go or Rust? (2018) by bryal on Tuesday May 07, 2019 @06:51AM (#19848214)
One factor is how simple it is to use an efficient data-structure in Rust vs C due to good polymorphism and easy dependency management. In C, importing and using an efficient data structure can be a chore, and so many implementations use suboptimal but more C-friendly structures instead.