For those who want to play our Home Game, I'm putting saves up on DFFD. They include annual saves for each experiment:
Fork Save (http://dffd.wimbli.com/file.php?id=5883)
Boulder Experiment (http://dffd.wimbli.com/file.php?id=5884)
Goblet Experiment (http://dffd.wimbli.com/file.php?id=5885)
Atom-smasher Fork Save (http://dffd.wimbli.com/file.php?id=5886)
Atom-smasher results Save (http://dffd.wimbli.com/file.php?id=5926)
Large and Small Contraction Experiments (http://dffd.wimbli.com/file.php?id=5906)
Medium Contraction Experiment save (http://dffd.wimbli.com/file.php?id=5913)
If someone wants to either help run some alternate tests, or else wants to try just continuing some of these experiments for another 10 or 20 years to see if you can get some further FPS degradation, that would help.
Initial Conclusions:
- Item count plays a clear and present role in FPS decay. The game decays in FPS to unplayability around 100,000 items. FPS decay seems to be sub-geometric.
- Dead things take up memory forever, and contribute to FPS decay.
- Consuming items in reactions takes up significantly more FPS drain than the act of creating them.
- Destroyed or consumed items, except for creatures that are listed as dead, are properly removed from play and take up no memory and produce no lag.
It is possible that changing the container class for items from an STL Vector to a Deque or custom container class may result in a faster game without having to significantly change aspects of the actual game.
Purpose:
Because of a certain thread (http://www.bay12forums.com/smf/index.php?topic=104450.0) where I postulated that a potential reason for unavoidable fortress entropic decay might be the data structures Toady is using in maintaining an index of all items might be a simple giant item index vector, which may actually never get any sorting, I now have to come up with some sort of proof of concept to actually get a bug report posted.
As such, I'm announcing Operation FPS Bomb, a !!SCIENCE!! project that attempts to understand how the data structures DF uses work, and can be better optimized.
Hypothesis:
Items in this game are tracked in an "Item Index Vector", a giant vector of items that just never really gets cleaned up, and as the game goes on, this vector keeps on getting filled up with items that, even when they are destroyed or permanently removed from the map, are still taking up some sort of reference slot in memory, and the game keeps on checking past them.
This would lead to the inevitable entropic decay of forts, the behavior that people have been complaining about killing even forts where players take every possible precaution and atom-smash all unnecessary objects. If even atom-smashed objects leave a "memory footprint" for lack of a vector sorting, then they will still cause a (lesser) degree of lag, even when they are completely destroyed objects.
Experiment:
Modded dwarves with no need to eat, sleep, drink, or do much of anything will have 21 custom workshops. 20 will all be doing the same thing, and the 21st workshop will be producing a single stone object repeatedly for the duration of the experiment. (This is to control for a possibility of a vector truncation in the case that large numbers of objects being removed will damage the
In the control, the 20 work dwarves will be performing a "Do Nothing" task with no reagent or product. It basically just keeps them sitting at a workshop busy without doing anything.
As the independent variable, the 20 work dwarves will perpetually alternate between a "create 20 stones" reaction and a "destroy 20 stones" reaction. This will create a large list of created and destroyed objects which, if cleanups took place, would result in no different FPS drop than in the control, but if my hypothesis is correct, will result in a noticably lower FPS than the control.
The experiment and control will run for 10 years to give the game enough time to make an appreciable difference.
I will also be doing several other experiments to see if different behaviors make a difference in how FPS degrades over time - magma destroying and atom-smashing have been reported to not fully "destroy" items in memory, so I'm going to try another experimental run with atom-smashing, and one with magma if I can get around to it.
Data:
I have set up my experimental fort. 21 "Sweatshop" workshops are built, and 16 dwarves have arrived. I am not going to start the full experiment until the start of year 2, which will be the forking point between the control and the experiment (so that the initial setup of the fort does not come out different between the two).
Unfortunately, I didn't do anything to stop dwarves from going "On Break", and there are some dwarves that still aren't working in their sweatshops like good zombie laborers. Useless curs! I don't pay them nothing to stand around talking, I pay them nothing to do my precious "do nothing" task forever!
I also forgot to custom-generate my world with no caverns, so there are probably some giant cave spiders lurking around, spitting webs, and doing some slightly random things to FPS. Hopefully, several years of item-creating will outweigh any cave spider webbing, and it will be roughly equal between both the control and the expermimental versions of the fort, anyway, so this shouldn't be too large an impact.
I have had to set my max FPS to 300, and I still manage to have full FPS initially.
However, as soon as the first caravan arrives (which I have built no Trade Depot for), my FPS drops to below 250. Even after leaving, it is at 275. This already starts to confirm the hypothesis, as I have experienced permanent FPS drop for simply having a merchant caravan walk on the map.
(http://i44.tinypic.com/2laufsm.png)
I hit the new year, and didn't get all the dwarven immigrants I wanted. I guess I'll just make do with what I have. Only 16 workers total, making and destroying 20 stones repeatedly forever.
(http://i42.tinypic.com/ot2rma.png)
I am working on the experimental version first. All regular workshops have their new orders:
(http://i40.tinypic.com/344719y.png)
FPS is more variable than it really should be - it must be some crundles hopping on and off the map down in the caverns, or some wolves moving around up top. FPS goes down to 220 and then back up to 280 again.
Year 2 caravan has arrived. FPS dipped to 210, occasionally going down to 195.
Start of year 3. FPS remains around 210. FPS seems to go up when I let DF run in the background while I'm typing these things. If I am typing, and I click back, it's back up at 250, but then immediately starts dropping again back down to 210. I guess the rendering of frames takes up some of the FPS.
Year 4. FPS is dipping down to as low as 180 now, but it still springs back up to 260. I guess there are too many crundles down there fighting it out with GCSes, and it's making these FPS readings a little too variable. Hopefully, if I can just keep the simulation running a little longer then the FPS will drop enough that the oscillations from that stuff will be drowned out more by the abuse I'm putting on the data structures.
Ugh... the game paused as one of the merchants apparently went berserk for no apparent reason instead of just sitting on the edge of the map and doing nothing like a good merchant who comes to a fortress that has walled itself in, and has never traded with you before, anyway.
Apparently, the guards had crossbows, the berserking merchant never stood a chance, and was promptly pincushioned with silver bolts. A yak cow also died, and there's now a bunch of useless trade crap sitting on the north end of my map. It's only about 40 items, however, so it shouldn't be too much of a drag on the FPS, considering the thousands of stone I already have.
For some reason, the bookkeeper seems bugged. He's been working nonstop at "updating stockpile records", and has hit legendary long ago, and is flashing purple, but I'm still at lowest precision in my stocks... I've finally gotten it working by unassigning my bookkeeper, unassigning the office, and then reassigning both.
... and the stupid berserk merchant just came back as a violent ghost. I had to make a craftsdwarf workshop to slab the stupid berserker. Amusingly, one of my workers was being attacked by the violent ghost the whole time, and didn't even stop working thanks to the NOEMOTION token. Her blood is splattered around her workshop, but she only seems to have a broken lip, and worked straight through it all.
FPS dropped as low as 150 when the caravan was on the map.
Year 5. Some of the merchants are still on the map for some stupid reason. Apparently, they got into a fight with a local wolverine. They might go berserk and start killing each other again, and then I'll need another slab... *sigh* why can't the other bugs leave me alone while I'm hunting the bug I'm after?
The merchants this year aren't going home, either... Some of them started going "stark raving mad" and attacking their yaks.
I'm building a trade depot now just to see if that stops them from behaving so buggy. Apparently, those stupid diplomats will never leave until they either die or speak to you, and walling them out is not an option (and when I un-walled my fort, I had 3 years worth of diplomats talk to me)... I have another bug report to make...
After un-walling my fort, I actually have regained almost all my FPS. This implies most of my losses in FPS were because of stupid merchant caravan problems in the first place.
I am at the start of year 6, so I have 5 full years under this experimental run.
I'm aborting this run, since I have too many silly things going on that have been mucking up the results. I'm reloading this from the fork again.
I'm going to try going back to the fork point, and restart this whole experiment with creating and destroying more stones at a time, while at the same time, not having my fortress walled up.
I've raised my maximum FPS again to an unreachable 3000 instead of 300. That way there aren't readings that are "off the charts" for FPS anymore. Restarting at the fork, I have an initial FPS of 400.
After letting it run for a game month, it's already down to 300 for some reason, although all I've done is set up a trade depot.
Caravan arrived. Just before it arrived, I was down to 260 FPS, after gradually dropping down from 300. When the caravan arrived and set up shop, it was down to 230 FPS. Then all my dwarves apparently smelled caravans at the trade depot, and half my dwarves decided to go on break all at the same time, and it shot up to 600 FPS. As soon as the caravan left, FPS went up even higher. I'm tapping 650 now.
Now it's year 3 (year 2 of experiment 2). FPS back down to 380, but it shoots up to 550 at times, especially when I leave it in the background to type something.
Year 4. FPS swings between 260 and 600. Mostly stays around 500, but it dips down to 300 or so at the turn of Autumn, but back up to 500 just before the caravans come. 350 while the caravans are here. 250 when they leave. 300 for all of winter. Winter seems to be the laggiest time of year.
Year 5. Game still running around 500 most of the time. Drops to 300 for caravan. Dips just below 180 at times as they get ready to leave.
(http://i42.tinypic.com/c3gjr.png)
Year 6. 480 most of the time, but it still swings up to 550. 320 during caravan.
Year 7. I'm only running this now to get 10 years of data. It dips as low as 300 or something occasionally, 200 for parts of the caravan, and then runs back up to 500. The average annual FPS is basically remaining stable.
Now, with year 11, the tenth year of the primary experimental run, I have an average FPS of 300 early in the year, going up to 400 and in the faster summer months, 500 again.
Basically, the run is over, and FPS has remained relative stable with no major degradation over the course of 10 years of playtime. This means my experiment has not reproduced the results that people were reporting earlier.
A poster in another thread named "o_O[WTFace]" suggested something that is worth investigating: I've been using stones, which have no particular data applied to them, and as such, I'm going to try running the experiment again, this time creating goblets instead of stones.
Starting year 2, the game is now flooding with announcements of masterpieces (thanks to me making the entire race legendary masons, and basing the reaction on masonry).
And it's getting really boring... I'm still not doing whatever it is that causes the gradual FPS death of forts that everyone always experiences when they make real forts, because I can't sink FPS below 200, and it goes through most of the same seasonal highs and lows.
Next up, atom-smashing, and seeing if that causes the FPS decay people talk about.
I wonder how much various user science bits have helped Toady over the years.
Recently somebody found what caused adamantine spires, hell on embark, collapsing caverns in the sky and general world corruption.
Wh... what was it?
http://www.bay12games.com/dwarves/mantisbt/view.php?id=5077
0005077: Browsing world gen map causes corrupted feature files
has duplicate 0002463 resolved Footkerchief Reproducible crash on worldgen
has duplicate 0002432 resolved Footkerchief Worldgen crash while Placing Civilizations: Impoverished Word Selector
has duplicate 0002713 resolved Footkerchief Massive aboveground adamantine spire, dwarves ignore designations, sometimes crashes
has duplicate 0005343 resolved Footkerchief 3/4 of the map is a big hole going straight to hell.
has duplicate 0005367 resolved Footkerchief cavern cavein on world gen/starting as an adventurer.
has duplicate 0005136 resolved Footkerchief Adventure mode crashes immediately after starting
has duplicate 0005187 resolved Footkerchief Embarking in a specific area causes a non recoverable lock up
has duplicate 0005401 resolved Footkerchief Crash on attempt to enter Dwarf Mode
has duplicate 0005043 resolved Footkerchief Human city inside of sand cavern
has duplicate 0004375 resolved Footkerchief Dwarven Town is in Hell. Huge lag makes game unplayable.
has duplicate 0005423 resolved Footkerchief Immediate crash upon selecting world and going to the site finder screen
has duplicate 0005425 resolved Footkerchief regions beyond region 1 not selectable and other worldgen weirdness
has duplicate 0005430 resolved Footkerchief two more necromancy bugs
has duplicate 0003831 resolved Footkerchief Start a new fort, dwarves all idle. No work at all.
has duplicate 0005306 resolved Footkerchief A new embark site has lava in the sky, cavern collapsed, game hangs up
has duplicate 0004163 resolved Footkerchief World gen doing crazy things with cavern placement.
has duplicate 0002268 resolved Footkerchief Cavern Lake Placement Error - Crossed Layers
has duplicate 0000051 resolved Footkerchief Cavern collapse at embark
has duplicate 0004833 resolved Footkerchief When embarking, crashes when memory use reaches 2GB.
has duplicate 0003356 resolved Footkerchief Embarked on a mountain of Slade, with Eerie Pits immediately revealed.
has duplicate 0003775 resolved Footkerchief World gen problems
has duplicate 0003101 resolved Footkerchief Square pit all the way down
has duplicate 0004840 resolved Knight Otu giant square hole on embark to hfs
has duplicate 0005268 resolved Footkerchief Crash on Embark
has duplicate 0005323 resolved Footkerchief Entering Fast Travel Causes Crash
has duplicate 0003884 resolved Footkerchief Consistent adventurer travel mode crash
has duplicate 0004385 resolved Footkerchief The Underworld has Collapsed.
http://www.bay12games.com/dwarves/mantisbt/view.php?id=5077#c20165
Lightning4: "I've discovered this bug exists as long as feature files have gone into the /current/ folder while browsing the map."
Vaporizing tests are going smoothly, so to speak.
Running at 40 FPS relatively reliably, so it'll basically take all day to run this test for a year.
(http://i43.tinypic.com/116jqfp.png)
I've downloaded the trading save, and will run it when this thing is done.
Kohaku, you may want to make a new thread with just the summary links to all the saves so everyone else can dive in and try them out for FPS measurements. Make it clear in the new thread's OP that commentary can go in this thread and that thread's purpose is to summarise and to record others' FPS readings.
Anyway, I've started up another fork save:
Fork save - Another (http://dffd.wimbli.com/file.php?id=5936)
This one was made with animal and plant testing in mind. Plump helmets give huge stacks and grow quickly. There are only 2 non-vermin animals: the catbird and the blue peahen. Both lay large clusters of eggs and the former has cat behaviour tags. As neither have the tags for beasts of burden, no caravans will arrive. This particular world was generated to have lots of badlands (no rain, no vegetation) but with 1 cavern layer (for the plump helmet experiment).
(http://i35.photobucket.com/albums/d159/Psieye/th_AnotherForkFarms.png) (http://s35.photobucket.com/albums/d159/Psieye/?action=view¤t=AnotherForkFarms.png)(http://i35.photobucket.com/albums/d159/Psieye/th_AnotherForkPots.png) (http://s35.photobucket.com/albums/d159/Psieye/?action=view¤t=AnotherForkPots.png)(http://i35.photobucket.com/albums/d159/Psieye/th_AnotherForkEggs.png) (http://s35.photobucket.com/albums/d159/Psieye/?action=view¤t=AnotherForkEggs.png)
The intentions are:
1) See if an abundance of plants causes lag by virtue of the game having to check whether they're rotting or not (even if they are in a food stockpile)
2) Experiment on different ways of animal disposal and how they affect FPS
It's late where I am - I'm going to bed now but I've put up the save in case someone wants to get started in my stead. Incidentally, I have 19 adults and 1 child - I got a mood. Thankfully a stone-only mood.
Ok, now presenting my work on the plant spam fort of Operation FPS Bomb.
=== Summary ===
A fort harvested and stockpiled (without barrels) 100k plants for the study of how they affect FPS. Intermediate saves were created at certain thresholds of stockpiled plants. The worldgen and raw data for this fort is detailed in this previous post (http://www.bay12forums.com/smf/index.php?topic=104643.msg3106918#msg3106918).
=== The Saves ===
http://dffd.wimbli.com/file.php?id=5954 (http://dffd.wimbli.com/file.php?id=5954)
This .zip contains saves taken at 0, 10k, 20k, 30k, 45k, 60k, 75k, 90k and 100k 'megashrooms', which are GROWDUR:3 plump helmets. All saves have no jobs awaiting (all farms empty, no workshop queues, nothing more to move to stockpiles) and the dwarves are walled in at a small meeting area. Every save is at spring, aside from the 75k save which is in summer (FPS was too low to wait for spring to come again). While the earlier saves have the same number of stockpiles each, these proved insufficient to hold the final quota of plants so later versions have more stockpiles and mined out space.
=== Methodology ===
Six farms were utilised for non-stop 'megashroom' farming with [SPEED:1], naturally legendary+5 planters. Seeds were generated by making booze from some of the harvest, using stone pots. Before the experiment began, a lot of storage space was dug out, designated and walled off in advance. This way, FPS would be saved during harvesting by only opening up each section of stockpiles when the previous one was full.
Due to the culling of the animal raws, no caravans will ever arrive and invaders were turned off. Therefore the only outside interference was the diplomat from mountain homes once the 2 hard-coded migrant waves came in. Said diplomat was always dealt with by going through the meetings ASAP. All animals in the fort were individually walled off in 1x1 cells. As per NW_Kohaku's original fork save, these dwarves don't emote, sleep, eat or drink (though they do go on breaks and have marriages).
Unfortunately, the amount of space that 100k plants take up (without barrels) as well as space to store the booze pots were both underestimated. By the end of the experiment, several additional storage areas had to be designated in new sections that were quarried out to make the stone pots. Four z-levels of this 2x2 embark are entirely filled with megashrooms and their wine - this still wasn't enough so the last of the produce spilled over into the surface.
An atom-smasher is provided in case further experiments in atom-smashing are desired.
=== Results ===
(http://i35.photobucket.com/albums/d159/Psieye/PlantFPS.png) (http://i35.photobucket.com/albums/d159/Psieye/PlantMem.png)
On loading of a save, the FPS would dip down (for 75k and above, down to 2 FPS). After some time, paused or not, the FPS would recover from this dip. The FPS would then very slowly increase until, several minutes later, it stabilised. The graph shows FPS readings taken at this peak. Note the FPS reading at 0 megashrooms has a large error bar because the season switched from spring to summer too quick before the FPS fully settled.
Results from further testing with these plant saves (e.g. removing all stockpile designations) will be linked here for future convenience.
Further Results (http://www.bay12forums.com/smf/index.php?topic=104643.msg3115576#msg3115576), now with item destruction to measure permanent FPS loss.
A study of cleanup during save/quit/reload (http://www.bay12forums.com/smf/index.php?topic=104643.msg3118504#msg3118504).
=== Conclusions ===
The original objective of demonstrating "having lots of plants = FPS damage" was successful. The extra stockpiles were only added from the 45k save onwards, but the FPS decay curve clearly starts before that. The disjoint in the curve between 30k and 45k is due to stockpiles eating up further FPS - this deserves some further investigation. The memory graph was included for completeness, it shows nothing unexpected - more items = more memory used. Remember that as the number of megashrooms stockpiled gets higher, the number of wine pots stored also increases so you can't directly translate that graph into a "plants take up this much memory" formula.
It was a good habit to be checking memory together with FPS though, as future tests will be trying to see how job spam and stockpile spam affect performance.
Thanks, Hazard! That makes sense. So there is no easy way to deal with people outside the map? What about items? Kohaku's post said that the stuff that caravans bring (but you dont buy) is deleted when the caravan clears the map, but that the items that you sell to them actually add to one of the files. Could those entries, wherever they were, be wiped without problems?
Thanks Psieye! Just what had me curious! This is a great insight into the powers of atomsmashing, autodumping, and also the arbitrarily expanding arrays! And you laid it out in a very readable manner. Atomsmash and destroy seem very comparable, meaning that both remove the items in the same way.
I'm kinda puzzled that you actually do not lose those ~200 fps of yours as long as you keep playing... If the arrays were growing as was suggested earlier, then you would be feeling a slowdown just from those fragmented arrays? Unless there's that bit where you do manage to delete everything in the array, after which the whole array goes.
From my understanding, apps cannot easily clean up their memory. At the very best, they can mark certain RAM areas as overwritable (by removing/invalidating the old pointers), and they are filled with new data as it becomes needed. Take Firefox for example, at the very moment I have 24 tabs on top (which is tame, i went as high as 140 tabs and they used to reload for 45 minutes due to all the processing, swapping, and transfer). They are set to load when selected, but when I start the Firefox, only one tab will be autoloaded and the RAM usage will be minimal. As I select more tabs, the RAM usage grows. So when I get an arbitrary feeling that Firefox has taken up enough, and I finished browsing with some tabs, I close Firefox and let it reload from the minimum RAM and full performance, the only downside being the 10 seconds that it took to restart.
That aside, I remember reading Toady's fairly recent market post which mentions something about city only tracking iterative changes, and the changes pile up until that area is saved to disk. Data becomes more volatile, but it saves up on disk writes a lot; so I am guessing that this could have been implemented in other cases as well. Did I dream this up or was this really said, tho...
Besides, my clothing is STILL not modded out, does anyone have a handy link on how to do that?
Simple, my friend!
I find the best way to do it is simply turn clothing into armor. This has the effect of stopping your dwarves from claiming or wearing clothing, unless it is specified via military uniform. This should only take you 1-2 minutes.
Find the 5 raw files (.txt files) that pertain to the 5 main types of body protection - in raw/objects, these are:
item_armor.txt
item_gloves.txt
item_helm.txt
item_pants.txt
item_shoes.txt
In each of these files, add [ARMORLEVEL:1] to each item that doesn't already have an [ARMORLEVEL:x] tag.
Example:
[ITEM_SHOES:ITEM_SHOES_SOCKS]
[NAME:sock:socks]
[ARMORLEVEL:1]
[LAYER:UNDER]
[COVERAGE:100]
[LAYER_SIZE:10]
[LAYER_PERMIT:15]
[MATERIAL_SIZE:1]
[SOFT]
[STRUCTURAL_ELASTICITY_WOVEN_THREAD]
Simple as that.
Edit: The best part of this, of course, is the ~10-20% FPS gain you get due to the clothing wear bug (http://www.bay12games.com/dwarves/mantisbt/view.php?id=3942). Of course, it's all fixed in the coming patch, anyway.
One more thing, one that no one seems to ever mention. If you embark with no clothing, doesnt that make your dorfs tremendously squishier? Like, even their constant pushing with animals could be harmful, as I've seen it mostly blocked by clothing otherwise?
Cloth provides very little protection. I've been running military forts without clothing for a while now and haven't noticed any difference at all.
I've been worried by the reports that open space causes FPS loss, even when it's not being pathed through. If it's inevitable, it's inevitable, but I wanted to see if pattern played a part.
HYPOTHESIS: There may be a different in FPS impact of open space, depending on layout.
METHODOLOGY: Set up a fort with food-, sleep- and booze-proof Dwarf miners in a flat place with a low cloud ceiling and no enemy civs. Wall them in and prepare a suite of craftshops on the first stone layer. Fork this fort. In one fork, dig out a 50x50 square of tiles. In the other fork, dig out a 2500-long snaking passageway. Collect all stone in a quantum pile, in the same spot near the craftshops. Set the craftshops running on the same task, and compare FPS. Once out of stone, wall off the 2500-tile gap, wait until the first caravan has come and gone, and compare FPS whilst everyone idles at a surface-side statue.
NOTES: Used autodump to collect the stone in a pile, then reclaimed it and slapped a 1-square stockpile over it. After the crafting, dug out a bit more stone around the craftshops until there was enough there to wall off the stairs. (Totally forgot I'd brought some wood for that purpose). The two migrant waves weren't quite the same size -- 11 adults and 1 child in the square fork; 6 adults, 2 horses, 2 cats and a child in the snake fork.
RESULTS
All results are +/- 15ish FPS. Fort was saved and DF fully quitted between each of the measurements
SQUARE SNAKE
DURING CRAFTING 390 470
IDLING BEFORE CARAVAN 370 445
DURING CARAVAN 335 410
AFTER CARAVAN 350 425
CONCLUSION
Holy hell. The Snake layout is a consistent 20% faster than the Square layout right across the board. And that's off just 2500 squares. I've used twice that just mining marble to trade on one layer of my current fort.
I suggest a new strategy, Artoo. TUNNEL EVERYTHING!
(http://i.imgur.com/6mrUt.jpg)
So I'm understanding correctly, in both cases the 2500 tiles of empty space were totally walled off and inaccessible, the only difference was the shape? The snaking passageway was one single curving hallway, or a branching maze? And both of these were on a single z-level?
Makes me curious what the difference between a 50 x 50 x 50 cube of open air vs. 125000 tiles of passages (one 1 or across several z-levels),
(http://i.imgur.com/RV83J.jpg)
Testing effects of open space on FPS using dfhack.
The goal is to increase understand of long term FPS loss with the hope of discovering how to decrease or eliminate it.
Summary of Conclusions:
Pathfinding is a lot more significant than open space with regards to FPS. Clearing a large section of the map only has about a 12% effect on FPS in and of itself. Pathfinding through that space while unable to reach the destination had about 5 times more effect on FPS. I didn't count the number of flying clowns. Visible but non-open tiles do not seem to have a significant effect.
Also, we could probably get better results by timing how long it takes to finish the season rather than a subjective evaluation of the FPS meter, then timing the second season, as paths and such would be cached by then.
Further research questions:
* Redo the experiments measuring elapsed real-time per season rather than looking at the FPS meter.
* Is dfhack tiletypes and manual in-game digging equivalent in terms of FPS?
* If the clowns could reach the dwarfs, would that reduce the FPS penalty?
* Large amounts of accessible/inaccessible floor (as opposed to open air) would be interesting to look further into, as the results were strange. Ghostwoods's experiment was in this vein.
* How much would it affect FPS if the dwarfs were able to reach the empty space (or floor), then it was blocked off by various methods (wall, floor, bridge, door).
* (Tangental) Is clown release deterministic?
* (Tangental) Get someone to put up a series of saves for a fort suffering from long term FPS loss, starting from embark, so that a comparative analysis can be done. What year has the largest FPS loss? What changed? In years that have little FPS loss, what changed so we can rule it out?
Baseline parameters:
FPS cap set to 10k
All tests were started with a fresh copy of the fork, and terminated at the end of the first spring.
All setup was done before the first unpause after loading. No changes were made after that.
In most tests, FPS has an initial stable value and a second stable value after a few weeks game time. The final stable value is the one reported.
It isn't part of the experiment, but DF is running in a VM.
Test 0: Save with no changes
FPS seems stableish at 400.
Test 1: 129 z-levels of open air (with clown introduced measurement error)
Go to level -3, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 131, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 131
paint mat stone
paint sh wall
paint hidden 0
<enter>
Move cursor 1 more tile SE, and up 1 zlevel
range
x: 90, y: 90,z: 129
paint mat air
paint sh empty
<enter>
(Oops, the circus came to town, water fills a few individual squares.)
FPS seems to be at a stable 200, sometimes dropping to 160-180, went all the way up to 250.
Test 2: 3 z-levels of open air (with clown introduced measurement error)
Go to level -3, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 5, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 5
paint mat stone
paint sh wall
paint hidden 0
<enter>
Move cursor 1 more tile SE, and up 1 zlevel
range
x: 90, y: 90,z: 3
paint mat air
paint sh empty
<enter>
(Oops, the circus came to town, water fills a few individual squares.)
FPS eventually stabilised in the 300-320 range, with spikes to 360.
Conclusions for tests 1 & 2:
We can conclude that ~1M tiles of inaccessible empty space drops FPS by ~68%, or put differently, every 15k visible tiles drops FPS by ~1% (assuming it's linear).
Oops, I made a mistake. Flying clowns need to pathfind through all that space. That invalidates the results as pathfinding and open space have became conflated.
It should be noted that if no path to the destination is available A* will do a complete and exhaustive search of every tile accessible to the unit, which is a huge performance hit. This is pretty much worst case for A* pathfinding.
Let's try this again without clowns.
Test 3: 128 z-levels of visible open air.
Go to level 2, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 130, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 130
paint mat stone
paint sh wall
paint hidden 0
paint special 0
<enter>
Move cursor 1 more tile SE, and up 1 zlevel
range
x: 90, y: 90,z: 128
paint mat air
paint sh empty
<enter>
FPS eventually stabilised in the 340-360 range, with spikes to 400.
Test 4: 3 levels of visible open air
Go to level 2, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 5, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 5
paint mat stone
paint sh wall
paint hidden 0
paint special 0
<enter>
Move cursor 1 more tile SE, and up 1 zlevel
range
x: 90, y: 90,z: 3
paint mat air
paint sh empty
<enter>
FPS eventually stabilises at 400, spiking to 420 and dropping to 360.
Conclusion for Tests 3 & 4:
We can conclude that ~1M tiles of inaccessible empty space drops FPS by ~12%, or put differently, every 83k visible tiles drops FPS by ~1% (assuming it's linear, which it probably isn't).
Further, we can attempt to unconflate pathfinding from the first run through. It seems ~84.6% of the FPS drop in the first run through can be attributed to pathfinding. Therefore FPS reduced by pathfinding through 98k empty tles is about 58%. Put another way, every 98k visible tiles reduced FPS by 1% due to pathfinding. (same linear disclaimer as above.)
-- Additional experiments --
Test 5: 128 z-levels of visible stone wall.
Go to level 2, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 130, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 5
paint mat stone
paint sh wall
paint hidden 0
paint special 0
<enter>
FPS eventually stabilises at 380-400.
Conclusion for test 5:
Visible, unopen space had no noticable effect on FPS.
Test 6: 128 z-levels of floor
Go to level 2, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 130, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 130
paint mat stone
paint sh wall
paint hidden 0
paint special 0
<enter>
Move cursor 1 more tile SE, and up 1 zlevel
range
x: 90, y: 90,z: 128
paint sh floor
<enter>
FPS seems a lot more variable, fluctuating from at least several seconds of stability at many values between 140 and 400. If I had to pick a number, I would say 200, but I definitely did not get a good reading.
No conclusions drawn due to poor measurements
Test 7: 128 z levels of visible air with access via stairs
Go to level 2, set hotkey F3
K, move curser to NW corner, then move SE 1 tile.
liquids
range
x: 92, y: 92, z: 130, depth: 0
<enter>
q
tiletypes
range
x: 92, y: 92,z: 130
paint mat stone
paint sh wall
paint hidden 0
paint special 0
<enter>
Move cursor 1 more tile SE, and up 1 zlevel
range
x: 90, y: 90,z: 128
paint mat air
paint sh empty
<enter>
Move cursor to NW corner of level 131, and then move SE by 2
range
x: 1, y: 1,z: 20
paint mat stone
paint sh stair_updown
F3 and up a level, so the same stuff is on-screen as in other tests while we're checking FPS
FPS: 340-360 It seemed to take longer to reach the stable point than test 3, but that wasn't measured.
SCIENCE!
(http://i.imgur.com/x8BZL.jpg)
That definitely helps put things in perspective. I assume these were all conducted wit the default traffic settings (normal=2, high=1), and the whole map set to normal (=2) traffic value?