programming languages ranked by speed ?

Which programming language is the fastest overall and why?


It is very difficult to answer this question, because it is almost impossible to write the same program in different languages, and even if you can, you measure the translator's effectiveness rather than language too much time. I actually tried to write the same program in different languages, here are the results:
  1. tricia> ./timeall
  2. C User: 27.52 Mem: 990844
  3. C++ User: 28.60 Mem: 992516
  4. Go User: 30.91 Mem: 1025592
  5. Java User: 37.90 Mem: 1294960
  6. Rust User: 30.20 Mem: 990616
Where User is user time. I have a Python version too, but it takes 30 minutes to run because Python is ill suited to this task. I didn’t include it because I don’t want to wait for 30 minutes to get the exact number.
Here is the thing though. If I change my input data, the C++ version can run faster than the C version. That isn’t unexpected, it happens because optimizers make different tradeoffs when compiling code, and which tradeoff works better depends on the data.
This program is about 500 lines (in for whatever language you choose.) Even with something this small, it’s difficult to say that those programs couldn’t be written to be faster. If the program was 200,000 lines, speed problems are likely not to be the result of some intrinsic limitation of the language, but of a poor design decision.
Or to put it more directly, the fact that Go appears to be 10% slower in my 500 line test program does not mean that a 200,000 line program written in C will be 10% faster than a similar program written in Go. There will probably be a substantial difference in speed between them, but I can’t say which will be faster. Most of it will be because they aren’t the same program, they won’t use the same algorithms, their libraries will make different tradeoffs and have different APIs.
programming languages ranked by speed ? programming languages ranked by speed ? Reviewed by wabpro on mai 11, 2019 Rating: 5

Aucun commentaire:

Fourni par Blogger.