Misunderstood-Wookiee / Mules-and-Warehouses-Extended

Compliation and Maintenace for the famous mule mods.
Creative Commons Attribution 4.0 International
12 stars 12 forks source link

Travel Mule performance improvements #77

Open bhayden53 opened 4 years ago

bhayden53 commented 4 years ago

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.

Misunderstood-Wookiee commented 4 years ago

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.

bhayden53 commented 4 years ago

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

Galaxy-Spam commented 4 years ago

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).

bhayden53 commented 4 years ago

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

Galaxy-Spam commented 4 years ago

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.

bhayden53 commented 4 years ago

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

Misunderstood-Wookiee commented 4 years ago

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

Galaxy-Spam commented 4 years ago

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

RabbitGame commented 3 years ago

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.

bhayden53 commented 3 years ago

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.

RabbitGame commented 3 years ago

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

bhayden53 commented 3 years ago

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.