0

Rust – Fibonacci using Recursion and Iteration

This post is about simple Fibonacci implementations in Rust using recursion and iteration. It also shows which on is faster than the other using differences of start and end times.

Date Time Support

To find out how long an implementation executes from start to finish, we use the Chrono crate. In our Cargo.toml, we indicate a dependency to that crate as follows:

Then, in the main.rs file put this use  statement:

Recursive Fibonacci

Iterative Fibonacci

50th Fibonacci Number

Output

Karl San Gabriel

Karl San Gabriel

Professional Software Developer