New question - Will walling off caverns from my fortress speed up FPS? Or making a door and forbidding it, and then setting the entire cavern to 'Restricted' traffic zone.
Short answer: YES.
Medium answer: Don't bother designating large swaths of restricted pathing; it doesn't buy you much. Designating high-traffic paths through large open spaces saves you far more FPS.
Long answer: A* (
basically!) works by extending a large number of invisible tentacles out from the dwarf, like a root system seeking water. Each invisible tentacle represents one possible path the dwarf could take while trying to get to the object in question. The algorithm maintains a set of tentacles of equivalent cost-length, and increments the tentacles' cost-lengths at the same time. When a tentacle hits a restricted area, that tentacle incurs the entire cost (say 25) at once, and stops growing until the other tentacles have all incurred 25 steps of cost as well.
So if your dwarf is standing in my hypothetical 15-tile-cube fortress, and all the travel costs are either normal or high-traffic, then the very worst case travel
distance is 35 and the worst-case cost is probably 60 or 85. If you have a single-tile shaft leading to your exploratory mining areas / caverns, you can place four consecutive Restricted tiles (cost = 25 each) and make any trip to the caverns more expensive than the longest possible trip within the fortress. There are upsides and downsides to this. The upside is that a dwarf inside the cube will never have to search outside the cube for anything he can get within the cube; conversely, any dwarf in a cavern smaller than a 2x2 embark (!) will almost certainly search the entire cavern area before he tries to search the cube. Again, this is accomplished by locking down
four tiles to raise their cost to 100.
If you wall off the caverns, no tentacle can ever reach them... but if you're taking my advice from above, no tentacle should ever need to search those areas unless there is something that is uniquely available in the caverns.
If your dwarves do need to scour the caverns you can use burrows, base camps, and high-traffic paths with restricted gutters (basically three parallel paths of RES/HT/RES) which will shuttle dwarves to the most useful areas like mineral veins, water sources, or flat areas with lots of silk and cavern life. Using traffic zones to build "rails" in this way can save a bunch of pathfinding costs when you want a dwarf to take a predefined path through a large open area. This is because the tentacles that try to go off the path are severely penalized, and so the more productive tentacles can look 25x further without the CPU bothering to expand the nonproductive ones.
(EDIT: cleared up some vague language)