| Crates.io | blazing_fibonacci |
| lib.rs | blazing_fibonacci |
| version | 0.2.5 |
| created_at | 2024-12-27 19:06:00.648839+00 |
| updated_at | 2024-12-29 14:14:52.270514+00 |
| description | A fast Fibonacci number calculator using matrix exponentiation and fast doubling. |
| homepage | |
| repository | https://github.com/alexcu2718/blazing_fibonacci |
| max_upload_size | |
| id | 1496568 |
| size | 19,632 |
A blazingly fast command-line Fibonacci calculator using matrix exponentiation and fast doubling.
This project was inspired by this YouTube video.
I created it to explore Rust's capabilities and, admittedly, to flex a bit!
cargo install blazing_fibonacci
blazing_fibonacci 18000000 -t Fibonacci number of 18000000 calculated, use -p to display Time taken: 956.54ms
(BENCHMARKS DONE ON ) CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz @ 20 GPU: TigerLake-LP GT2 [Iris Xe Graphics] Memory: 7392/19778 MiB
Decided to remove Rayon dependency as wanted to stay true to original goals, Implemented the fast doubling algorithm Error handling, avoiding a panic basically if no number entered.
Added Rayon as a dependency, it's pretty much in every crate anyway. It can now calculate up to 11million in less than a second on a shitty computer!
To install the calculator, use the following command:
blazing_fibonacci 1000 # Calculate the 1000th Fibonacci number
blazing_fibonacci 1000 -p # Calculate and print the full number
blazing_fibonacci 1000 -t # Show the calculation time
blazing_fibonacci -h # Show help and usage instructions
for i in {1..1000}; do blazing_fibonacci $i -p -t | sed -n '2,3p' | awk -v num=$i '{print num, $0}' >> ~/TESTFIB.txt done