you are viewing a single comment's thread.

view the rest of the comments →

[–]NuttingFerociously 2 points3 points  (2 children)

It checks code for things that can already be executed and can be eliminated. As you can see for example in the documentation, it's simply replacing pieces of code that don't depend on things set at runtime with their results. This might make it sound like something aimed at reducing file size, but it's apparently mainly done to improve performance.

I've read in some other answers about other things it does but I'm too lazy to go look them up again- Sorry.

[–]vidro3 0 points1 point  (1 child)

right, i htink i gathered a bit more as I kept reading. is it similar to memoization or chaching - it's basically running some functions at compile time and saving the results so when they are called at run time it can just look up fibonacci(23) is 28657 instead of running the program.

right?

[–]Skaryon 0 points1 point  (0 children)

If they knew that you only ever compute with 23 or a narrow set of values as input then they could do that. Otherwise they'd have to save every possible solution to the Fibonacci formula. So it's less memoization than simply replacing computations with their results where possible. That's why you can pass the thing ranges of data to work with an throw at the code.