Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travel Mule performance improvements #77

Open
bhayden53 opened this issue Jun 7, 2020 · 12 comments
Open

Travel Mule performance improvements #77

bhayden53 opened this issue Jun 7, 2020 · 12 comments
Labels
Looking Into This is being investigated. Suggestion A suggested change.
Milestone

Comments

@bhayden53
Copy link
Collaborator

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
Copy link
Owner

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
Copy link
Collaborator Author

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

@Misunderstood-Wookiee Misunderstood-Wookiee added this to the Code Refactor milestone Jun 8, 2020
@Misunderstood-Wookiee Misunderstood-Wookiee added Looking Into This is being investigated. Suggestion A suggested change. labels Jun 8, 2020
@Galaxy-Spam
Copy link
Collaborator

Galaxy-Spam commented Jun 9, 2020

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
Copy link
Collaborator Author

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

@Galaxy-Spam
Copy link
Collaborator

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
Copy link
Collaborator Author

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

@Misunderstood-Wookiee
Copy link
Owner

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

@Galaxy-Spam
Copy link
Collaborator

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

@RabbitGame
Copy link

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
Copy link
Collaborator Author

bhayden53 commented Apr 6, 2021

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
Copy link

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
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Looking Into This is being investigated. Suggestion A suggested change.
Projects
None yet
Development

No branches or pull requests

4 participants