3

各大主流编程语言性能PK,结果出乎意料 | 程序师 - 程序员、编程语言、软件开发、编程...

 1 year ago
source link: https://www.techug.com/post/performance-pk-of-major-mainstream-programming-languages-unexpected-results48ca6676ad0a791fada5/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

各大主流编程语言性能PK,结果出乎意料

2

出品 | OSC开源社区(ID:oschina2013)

“什么编程语言速度最快”,为了回答这个问题,The Benchmarks Game 专门面向主流编程语言设计了性能测试。测试的项目包括(可点击文末阅读原文查看详情):

  • fannkuch-redux

  • n-body

  • spectral-norm

  • mandelbrot

  • pidigits

  • regex-redux

  • fasta

  • k-nucleotide

  • reverse-complement

  • binary-trees

开发者根据 The Benchmarks Game 的测试数据制作了一份可视化图表,如下所示,灰色反映的是时间效率,越短代表性能越好,棕色则是基于执行时间和内存开销的加权值。

可以看到,部分结果还是有点出乎意料,比如 Python,虽然众所周知其性能比较落后,但没想到在执行时间方面居然是垫底。C、C++ 和 Rust 的执行时间表现出了领先的优势,紧随其后的包括 C# 和 Julia,Go 和 Java 性能相当,不过排在更后面。

再往后就是 Node.js、Swift 和 Dart,以及 PHP,这几种语言也呈现了不同的性能差距。

本文文字及图片出自 OSC开源社区


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK