Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Increase PathFinder maxRooms maximum to 64 #31
Some users have said that increasing this limit would be useful to them. Since any time the pathfinder enters a room it counts against maxRooms, you usually end up with a maximum path shorter than 16 rooms long.
With the existing code the highest we could bump the k_max_rooms constant to was 24, so I went through and audited and updated the data structures in use. This increases memory usage a little, but reduces CPU overhead a little bit too (by about 7%). The pathfinder is almost allocation-free which means that it allocates all the memory it could possibly need upfront and holds on to it for the program's lifetime. The old code would use ~49kb of memory per thread per k_max_rooms, plus about 74kb of other overhead. The new code uses ~84kb of memory per thread per k_max_rooms, plus the same overhead.
Assuming a 4 thread server, before this patch the pathfinder will hold onto ~3.63mb of memory. After this patch it will hold onto 17.27mb of memory. I don't think that number is unreasonable by any measure but I did want to make sure to communicate the exact cost of this change. And like I mentioned it is 7% faster, at least on my system and probably most 64-bit systems.
This also includes the fix for the "Max heap" issue we discussed a couple days ago. It'll automatically adjust the heap size to the correct capacity based on k_max_rooms.