beyond-all-reason / BYAR-Chobby

Currently used legacy lobby for BAR, for the new lobby development see https://github.com/beyond-all-reason/bar-lobby
59 stars 69 forks source link

[FR] Background cache task #712

Closed d5xtgr closed 3 months ago

d5xtgr commented 3 months ago

When I launch BAR, I have to wait five or ten minutes for it to cache everything it needs. However, if I let it cache completely and then exit and restart the game without playing a match, I can load in right away the next time. It would be nice to have a command to cache that I can run in the background (i.e. without launching the whole game) at a low priority a couple times per day with cron, so that when I launch the game it's ready more promptly. A command-line argument to the game executable seems like the natural way to do it.

p2004a commented 3 months ago

Based on how you phrased it, I will assume Linux. Just run in the installation directory

ionice -c 3 find pool -type f -exec sh -c 'cat {} > /dev/null' \;

That's basically what caching in lobby does.

Edit: I believe something like

grep -r invalid-not-found-string

run from the pool directory will do the same and way, way quicker.

d5xtgr commented 3 months ago

Based on how you phrased it, I will assume Linux.

Correct.

grep -r invalid-not-found-string

run from the pool directory

That worked! I didn't even consider that it was a system-level cache the game was referring to. I spent some time reading up on how that works on Linux, and it looks like vmtouch will be my go-to solution for this. Thank you very much!