1024programmer Java nodepython speed_c, golang, java, php, nodejs, python, pypy operation speed rough comparison

nodepython speed_c, golang, java, php, nodejs, python, pypy operation speed rough comparison

Throw out the result first,

run java:

end i:1000000000 count:499999999500000000 time:0.638

run C:

end i:1000000000 count 499999999500000000 time:0.641424

run go:

end i:1000000000 count:499999999500000000 time:1.277728

run pypy:

end i:1000000000 count:499999999500000000 time:3.81583285332

run php

end i:1000000000 count:499999999500000000 time:26.515455007553

run nodejs:

end i:1000000000 count:499999999500000000 time:148.331

run python:

^Tend i:1000000000 count:499999999500000000 time:193.98550415

The above results have optimized the performance of golang and c.

This result is beyond my expectations.

1. Neither c nor golang has started optimization. So the performance is only in the middle position. As a reference time

2, java, nodejs and pypy, all using JIT can operate very quickly. (It is related to the current test algorithm, but it is indeed obvious that repeated operations It is helpful)

3. There is no obvious difference in the operation speed of static language and dynamic language. The key point is whether there is JIT

4. Python is too slow. I have always known it. Python is slow, but I didn’t expect it to be slower than PHP in terms of calculations.

5. Nodejs is not as ideal as large number processing. If BigInt is not used, it is indeed faster than PHP, python, and pypy.

ps:

1. Finally look forward to php8, because php8 comes with jit.

2.php has indeed missed better development. If accepted in 2011 After HHVM, you may no longer be in the same state. Things are like this. When you are at your peak, you will start to decline. Only by making constant changes will you remain invincible.

Test code:

https://gitee.com/goodtim/LangTest

The result of not optimizing golang and c, nodejs does not use BigInt processing:

run C:

end i:1000000000 count 499999999500000000 time:5.403450

run go:

end i:1000000000 count:499999999500000000 time:4.085926

run nodejs:

end i:1000000000 count:499999999067109000 time:2.568

run java:

end i:1000000000 count:499999999500000000 time:1.281

run php

end i:1000000000 count:499999999500000000 time:27.162304878235

run python:

end i:1000000000 count:499999999500000000 time:200.6685 12821

run pypy:

end i:1000000000 count:499999999500000000 time:3.82159590721

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/nodepython-speed_c-golang-java-php-nodejs-python-pypy-operation-speed-rough-comparison-2/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索