Misunderstood-Wookiee/Mules-and-Warehouses-Extended

Travel Mule performance improvements

Opened this issue · 12 comments

I was testing in debug mode and a travel mule assigned to a player warehouse full of wares was producing ~70000 trade combinations that needed evaluating. In debug mode this was actually causing a 5+ second total freeze-up.

This might be a good place to introduce the scantickrate for performance testing/improvements.

Yeah scan tick rate would improve all of the mules imo.
We should investigate that other guys fork and see the improvements made maybe move them over to our 3.20 public.

The scantickrate is not that complex, I will implement it myself where I know the performance bottlenecks are likely to be.

i would assume that a majority of the lag is actually caused by the logging.
Try setting the debug change to 0 and rerun the script.
We could think about a verbose/nonverbose debugging (debug level).

Yeah but I don't recall travel mule being this bad in the past when testing.

We did introduce a full trade offer dump though:
<run_script sinceversion="2" chance="$debugchance" name="'mule.lib.debug.dump_tradeoffers'">.
Twice actually. Dumping all trade offers will likely be the cause of lag.

Ah, good call. I forgot we added that run_script to travel mule.

@Galaxy-Spam @bhayden53
Where do we stand on this?
I don't think we ever fully fixed it?

Still just the bandaid, but it will likely be fixed with the upcoming (larger) patch that (hopefully) uses a blocking order.

I have this problem too. The game freeze for ~6 Seconds when an travelmule is searching for orders. It uses a Warehouse with many goods. If I can contribute with a savefile or something i can do it.

It's a known issue when the trade space is very large (lots of wares and a big jump distance).

Best bet is to limit the jump distance to 4 or 5.

6 seconds is awfully long though; are you playing with debug turned on or anything? I've never seen anything even approaching that unless I had debug turned on.

I had startet the executable with"-logfile debug.txt". It is better without it. It only freezes 1 Second now.
I have testet a little bit with the restrictions to factions. I set all wares to only sell to my own faction and the travel mule still freezes the game for 1 Second. Maybe he is checking the Wares that cant be sold to NPCS regardless of the restriction. I will test a little bit more to give more accurate information

Yeah, the issue with trade rules is that we have to filter them out ourselves, it doesn't restrict the trades that the functions return back to us; so even with trade rules, the loop is ultimately the exact same size as it was before.

The only ways that the user has control of to reduce the trade space to avoid frame hiccups are to lower the number of wares considered, or lower the number of jumps considered.