Coder Social home page Coder Social logo

iwasiman / rust-speed-compare Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 21 KB

同じ処理をする関数でRust言語と他の言語で速度比較をしてみたサンプルです。

Go 16.98% PHP 11.26% Ruby 5.46% Rust 21.95% Python 10.08% Java 20.90% JavaScript 13.37%

rust-speed-compare's Introduction

rust-speed-compare

同じ処理をする関数でRust言語と他の言語で速度比較をしてみたサンプルです。

引数n,x Ruby
2.6.8
Python
3.9.13
PHP
7.4.3
JavaScript
(Node.js 16.16.0)
Java
18.0.2
Go
1.18
Rust
1.62.1
1万 6.862s 8.573s 4.788s 0.437s 0.222s 0.544s 0.423s
10万 11m26.039s 15m58.473s 7m56.201s 11.835s 8.516s 4.706s 4.866s
100万 未測定 未測定 未測定 23m15.576s 14m22.989s 10m5.680s 10m13.068s
200万 未測定 未測定 未測定 86m5.192s 58m30.928s 45m10.163s 43m36.613s

データ件数1万レベル

  • RustはRubyの約16倍、Pythonの20倍、PHPの約11倍を達成。Goとほぼ互角。Javaも速い。
  • なおRustは> cargo buildでデバッグビルドすると6.125s、リリースビルドすると上のように0.423sで14倍ぐらい違う。RustもGoも2回めの実行からは0.1sを切ってさらに速い。
  • インタープリター型言語はすでに4〜8秒掛かるが、JavaScript(Node.js)だけは1秒を切っており遜色ない。

データ件数10万件レベル

  • RustはRubyの約140倍、Pythonの約170倍、PHPの約98倍、JavaScriptの2.4倍、Javaの1.8倍を達成。ここでもGoとほぼ互角。
  • インタープリター型言語は8分〜16分と一気に遅くなる。今回の計測では何気にPHPが頑張っている。もっとも遅いのはPythonだった。JavaScript(Node.js)だけは10秒台で良好。

データ件数100万件レベル

  • 僅差でGoの方が速かった。それでもRustはJavaの1.4倍、JSの2.3倍を達成。

データ件数200万件レベル

  • Rustがもっとも速い。Goの1.03倍、Javaの1.3倍、JSの2倍。健闘してきたJSもここに来ると1.5H掛かるようになる。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.