Skip to content

Fibonacci algorithm implemented in a few compilable languages in different programming flavors

License

Notifications You must be signed in to change notification settings

yegor256/fibonacci

Repository files navigation

new

Here we compare Fibonacci algorithm implemented in C++, Rust, Lisp, Haskell, Eiffel, and some other compiled programing languages in different programming styles, like object-oriented, procedural, functional, etc. We are trying to understand which style compiles to shorter binary code and works faster. If you can imagine some other way how this algorithm could be implemented in C++ or other languages, don't hesitate to submit a pull request.

Recent results are published here:

To build it locally, just run:

$ make

The result will be in summary.txt file.

To analyze the quality of the code in this repo and make sure there are no hidden defects, run all static analyzers and style checkers:

$ make sa

You need to have Clang, Make, Rust, Common Lisp, Haskell, GraalVM, Ruby, Go, Clang-Tidy, Clang-Format, cppcheck, and cpplint installed. It's better to check this file for the full list of dependencies.

How to Setup

If you want this code to run on your own machine, you will need to configure a self-hosted runner, as it's done in this repo. Just rent a server with at least 8Gb RAM (not Docker!) and then login there as root:

$ adduser --quiet --disabled-password --force-badname --gecos "" runner
$ usermod -aG sudo runner
$ echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
$ su - runner

Then, you follow the instructions from here.

About

Fibonacci algorithm implemented in a few compilable languages in different programming flavors

Topics

Resources

License

Stars

Watchers

Forks