eyeonus / Trade-Dangerous

Mozilla Public License 2.0
97 stars 31 forks source link

Avoid excessive loops #93

Closed MSNexploder closed 3 years ago

MSNexploder commented 3 years ago

Evaluate all filter conditions instead of looping over all stations separately for condition provided. This leads to a quite substantial speedup if multiple filter conditions are provided.

e.g. measuring trade run --from "Xi Ursae Majoris/Durrance Dock" --credits 17m --capacity 88 --ly-per 17 --jumps 1 --hops 5 --ls-penalty 1.5 --margin 0.02 --pad-size ML --planetary N --fleet-carrier N --unique --max-days 7 --color --progress gave me the following number:

before 15811707 function calls in 38.499 seconds
after 14117624 function calls in 28.854 seconds
eyeonus commented 3 years ago

Sounds good to me.