I made a slight update to the lazy binomial tree in Javascript.

As the tree grows branches point to the same node - meaning we can prune identical nodes and double the probability of landing on that node.

The original tree with 8 steps from beginning to end has 510 nodes versus a mere 230 in the recombined version.

Pruning makes pricing exponentially faster in the face of exponential growth.

Interestingly Firefox sometimes makes ever so small mistakes when calculating the probabilities, leading to less pruning and a slightly less efficient calculation.

Code here.

"Arbre Binomial Options Reelles" by Virginie Joly-Stroebel - Own work. Licensed under CC BY-SA 3.0 via Wikimedia Commons.

While errors are never good, what is interesting is that Javascript has so many large organisations developing engines to make the language run better.

The competition is ferocious. Lots of money is being invested into the eco system by Apple, Mozilla, Google and Microsoft. You don't get that with other languages.

How many organisations are pumping money into independent Python or R implementations for example?