Performance optimizations#3
Conversation
|
Double check the rusty portions of this, I don't really know rust so i'm not confident that is the best/normal way to do some of it |
| let mut game = GameState::from_starting_pairs(&pairs); | ||
| let optimal = game.find_optimal_strategy(); | ||
| let start = &case.0; | ||
| let optimal = &case.1; |
There was a problem hiding this comment.
maybe this could be unpacked better?
For the optimizer changes:Changes from computing the optimal strategy ~27k times to just 3. For me this goes from over 10 minutes to about 5 seconds to run the optimizer. Also implements caching on the optimal strategy tree navigation. Once entering the map and inside the harvest, the optimal strategy for, say This is proven via the google sheet having same y/b/p expected outputs for every sheet For memoization of optimal_value:Strategy is memoizing on current plot state + current upgrades. For me this went from ~5 seconds to <0.5 seconds (ish), and appears to be computing optimal path for around the same duration as writing to files (when using optimizer) now. Logic for the memoizing strat is if i start with Also proven via google sheet and this producing the exact same final output. (technically there is some floating point error differences but since the sheet trims to 2 decimals it is fine, only really noticed i when I was trying to determine what to cache) |
|
Forgot if i commit to master on my fork it updates pr oops. so now this has both changes. Modified pr summary to reflect, although i can split the optimizer stuff and memoization into two commits if desired. Will make a branch on my fork if i do more stuff lol |
Changes from computing optimal strategy every different config of atlas to not recompute it if the nodes changed aren't effecting dropped lifeforce from a plot.
Adds memoization on the compute_optimal_value, via current plot state + current upgrades.
For my PC, went from over 10 min to compute optimal strategies to under half a second