This is a collection of programs written in various languages to perform the exact same tasks as a demonstration of both the syntactic differences between these languages as well as the run-time speeds of their respective compiled (or interpreted) outputs.
There are two ways to run the code examples:
git clone https://github.com/luke5542/LanguageComparison
).cd sieve-of-eratosthenes
)make runall
to run all tests in that directorydocker pull quay.io/passmcr/languagecomparison
docker run quay.io/passmcr/languagecomparison
docker run -it quay.io/passmcr/languagecomparison /bin/bash
Note: Running docker on Windows or MacOSX (currently) requires the use of a boot2docker VM or something similar. This obviously has an overhead associated with it - however as long as the tests are all run in a container, the results should be roughly consistent with those obtained outside of a container.
A HTML page can be generated in order to visualise the various run timings.
output
using python3 ./generate_data.py -b
.benchmark.html
) with the results is generated and placed in the root directory of the project.-s
flag can be used to set the maximum size of the sieve.