2017年的golang、python、php、c++、c、java、Nodejs性能对比[续]

时间:2022-07-23
本文章向大家介绍2017年的golang、python、php、c++、c、java、Nodejs性能对比[续],主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

2017年的golang、python、php、c++、c、java、Nodejs性能对比[续]

  好了,上回的某些事有些人有异议,今天也回应下。

  1.有人说python性能没那么Low?

  这个我用pypy 2.7确认了下,确实没那么差, 如果用numpy或其他版本python的话,性能更快。但pypy还不完善,pypy3在beta, 所以一般情况,我是说一般情况下,这点比较让人不爽。

qiangjian@sun-pro:/works/learnCPP$ pypy -V && time pypy fib.py
Python 2.7.12 (aff251e54385, Nov 09 2016, 17:25:49)
[PyPy 5.6.0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
5702887

real    0m0.206s
user    0m0.173s
sys     0m0.028s

  2.有人说怎么没有C#、Rust、Ruby这个那个的?

  我只想说语言百千万,实在太多,但精力不要放在工具上, 选择一个合适的就好。

  实在想看,也有:

Language

CPU time

Slower than

Languageversion

Sourcecode

User

System

Total

C++

previous

C++ (optimized with -O2)

0.899

0.053

0.951

g++ 6.1.1

link

Rust

0.898

0.129

1.026

7%

7%

1.12.0

link

Java 8 (non-std lib)

1.090

0.006

1.096

15%

6%

1.8.0_102

link

Python 2.7 + PyPy

1.376

0.120

1.496

57%

36%

PyPy 5.4.1

link

C# .NET Core Linux

1.583

0.112

1.695

78%

13%

1.0.0-preview2

link

Javascript (nodejs)

1.371

0.466

1.837

93%

8%

4.3.1

link

Go

2.622

0.083

2.705

184%

47%

1.7.1

link

C++ (not optimized)

2.921

0.054

2.975

212%

9%

g++ 6.1.1

link

PHP 7.0

6.447

0.178

6.624

596%

122%

7.0.11

link

Java 8 (see notes)

12.064

0.080

12.144

1176%

83%

1.8.0_102

link

Ruby

12.742

0.230

12.972

1263%

6%

2.3.1

link

Python 3.5

17.950

0.126

18.077

1800%

39%

3.5.2

link

Perl

25.054

0.014

25.068

2535%

38%

5.24.1

link

Python 2.7

25.219

0.114

25.333

2562%

1%

2.7.12

link

还有权威对比: https://benchmarksgame.alioth.debian.org/u64q/go.html   原文 https://blog.famzah.net/2016/09/10/cpp-vs-python-vs-php-vs-java-vs-others-performance-benchmark-2016-q3/

   大家看看就好。

  最后,就是加个大图,说明一切

  但是图中没有算compile时间,对动态语言不公平。

  另外, 性能相差不大的话, 谁开发效率高,谁是王者, 明显Go是未来明星(也许要加之一,哈哈),nodejs潜力不小!!!