Join GitHub today
Fix and improve path finding #719
This PR fixes several bugs and adds improvements making path finding results better, returning them in a shorter time.
The most severe bug was found in
I added a new test explaining why the old code was wrong. Consider the path:
The old algorithm would not find a path as it is not possible to buy
Fixing this introduced a huge optimization opportunity. Basically the cost of trades between current source asset and the destination asset does not change after prepending the path with a new asset. So we can cache the results instead of checking every order book on the path every time we add a new asset in the front of the path.
Another improvement was to remove
After implementing all the optimizations average search time for my queries dropped from 10 seconds to 2 seconds giving a better results.
Finally, a single search is run in