Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niklas-heer/speed-comparison
A repo which compares the speed of different programming languages.
https://github.com/niklas-heer/speed-comparison
c clojure docker elixir golang hacktoberfest javascript julia nim-lang php programming-languages python ruby speed-comparison swift
Last synced: about 6 hours ago
JSON representation
A repo which compares the speed of different programming languages.
- Host: GitHub
- URL: https://github.com/niklas-heer/speed-comparison
- Owner: niklas-heer
- License: mit
- Created: 2018-02-17T15:32:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T22:14:47.000Z (21 days ago)
- Last Synced: 2024-09-24T22:04:00.573Z (about 11 hours ago)
- Topics: c, clojure, docker, elixir, golang, hacktoberfest, javascript, julia, nim-lang, php, programming-languages, python, ruby, speed-comparison, swift
- Language: Earthly
- Homepage: https://niklas-heer.github.io/speed-comparison
- Size: 12 MB
- Stars: 475
- Watchers: 16
- Forks: 77
- Open Issues: 35
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![plot](https://niklas-heer.github.io/speed-comparison/assets/latest/combined_results.png "Speed comparison of programming languages")
---
# Speed comparison of programming languages
This projects tries to compare the speed of different programming languages.
In this project we don't really care about getting a precise calculation of pi. We only want to see how fast are the programming languages doing.
It uses an implementation of the [Leibniz formula for π](https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80) to do the comparison.
Here is a video which explains how it works: [Calculating π by hand](https://www.youtube.com/watch?v=HrRMnzANHHs)You can find the results here: https://niklas-heer.github.io/speed-comparison/
## Disclaimer
I'm no expert in all these languages, so take my results with a grain of salt.
Also the findings just show how good the languages can handle floating point operations, which is only one aspect of a programming language.You are also welcome to contribute and help me fix my possible horrible code in some languages. :smile:
## Run it yourself
Everything is run by a Docker container and a bash script which envokes the programs.
To measure the execution time a [python package](https://pypi.python.org/pypi/lauda/1.2.0) is used.
### Requirements
- `Docker`
- [earthly](https://earthly.dev/)### Run everything
Earthly allows to run everything with a single command:
```bash
earthly --config earthly-config.yml +all
```
This will run all tasks to collect all measurements and then run the analysis.### Collect data
To collect data for all languages run:
```bash
earthly --config earthly-config.yml +collect-data
```To collect data for a single languages run:
```bash
earthly --config earthly-config.yml +
```### Analyse results
To generate the combined CSV out of all results use this command:
```bash
earthly --config earthly-config.yml +analysis
```## FAQ
> Why do you also count reading a file and printing the output?
Because I think this is a more realistic scenario to compare speeds.
> Are the compile times included in the measurements?
No they are not included, because when running the program in the real world this would also be done before.
## Thanks
The list of Contributors is automatically generated.### Contributors
Niklas Heer
Francesco Alemanno
Yu Zhu
Jerry Ling
Gaute Hope
frakod
Jonathan Carroll
Sıddık AÇIL
S Knutsen
Gabriel Baraldi
Serg Gini
Joe Landman
Sandeep Kumar
mattn
Chris Nuernberger
LazyKernel
Michael Abbott
Oscar Smith
Páll Haraldsson
DirkieDurky
Gui Zhen Wei
Lorenzo Gabriele
RDPatrickTheDev
Proudust
Sergey Trofimov
Thomas A Caswell
Tomohiro
genmeblog
Yuta Imazu
Kohei Hosoki
### Special thanks
#### sharkdp
For creating [hyperfine](https://github.com/sharkdp/hyperfine) which is used for the fundamental benchmarking.
#### Thomas
This projects takes inspiration from [Thomas](https://www.thomaschristlieb.de) who did a similar comparison [on his blog](https://www.thomaschristlieb.de/performance-vergleich-zwischen-verschiedenen-programmiersprachen-und-systemen/).