Created
February 14, 2026 13:07
-
-
Save espio999/708ed4b7daf5b12c46d837d7cdfb43cf to your computer and use it in GitHub Desktop.
performance comparison for fibonacci.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <script src="fibonacci.js"></script> | |
| <script> | |
| function measurePerformance(label, func){ | |
| const point_start = `${label} ----- start`; | |
| const point_finish = `${label} ----- end`; | |
| performance.mark(point_start); | |
| console.log(func(n)); | |
| performance.mark(point_finish); | |
| const duration = performance.measure(label, point_start, point_finish).duration; | |
| console.log(duration); | |
| } | |
| const n = 70; | |
| //measurePerformance("normal", fibonacci); | |
| measurePerformance("memoization", memoized_fibonacci); | |
| measurePerformance("tail recursion", tail_rec_fibonacci); | |
| </script> | |
| </head> | |
| <body></body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment