Using Memoization to Speed Up Code
xxpertHacker (613)

What is memoization?

Yeah, that's right, memo, not memor. I asked my self this when I first saw it. Simply put, memoization can be described as the caching of the results of a sub-step within an algorithm.

That makes it perfect for recursive functions, as they waste plenty of time recomputing everything, so that's what I tried it on, a recursive function.

And what recursive function is better known than a function to calculate the Fibonacci sequence?

After learning about memoization and how to do it, I spent hours perfecting a memoization wrapper which I then used on a JavaScript bigInt Fibonacci function.

I then laughed at the speed differences.

I calculated 1000 iterations of the Fibonacci sequence in 1 second. Without it, it took forever. You can try any number less than 200,000 without choosing to loop, and you'll receive an answer within 10 seconds, guaranteed or I'll refund you.

Try it out yourself!

Some links I looked at:

You are viewing a single comment. View All
xxpertHacker (613)

@bgrubert Yes, as my associate wrote, when the global pandemic is over, we will refund you in full. As of right now, any more runs will no longer be refunded. In order to refund you in full, we need to request that you provide us with the following information: to know where to send your refund: the planet where you're home is located (if applicable), the country (if applicable), the state (if applicable), providence (if applicable), region (if applicable), city / town, (if applicable), street (if applicable), mailbox (if applicable), home address (if applicable), and, preferably, some details about the external part of your house (if applicable) that distinguishes it from any nearby houses (if applicable). If none of the information requested is applicable to your current situation, please provide an address where you would like us to send your refund. And once again, this will only happen if and when the quarantines end, in both, the city that © StudentFires is located, and in the requested delivery area.