|Anonymous | Login | Signup for a new account||2022-01-27 01:12 PST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005971||Dwarf Fortress||Dwarf Mode -- Jobs, Eating/Drinking||public||2012-05-30 03:59||2014-07-23 12:43|
|Assigned To||Toady One|
|Target Version||Fixed in Version||0.40.05|
|Summary||0005971: Fat dwarves eating causes lag.|
|Description||Wasted CPU can be expected to be on the order of 5-10%.|
The lag is caused by the interaction of two factors:
1) When the unit's fat amount crosses a 2500 boundary, its clothing insulation is recomputed.
2) Fat is capped at 1000000, which is divisible by 2500.
The result is that for every unit at 1000000 fat with digestion counter active, it recomputes insulation every frame, because of jitter caused by interaction between +5 from digestion (hits the boundary) and -random from natural consumption (doesn't). This can be very easily worked around by capping at 999999 instead of 1000000.
|Steps To Reproduce||Set units to 1000000 fat and activate their digestion counter (the one incremented when eating/drinking non-water).|
|Additional Information||Profiling graph with the problem active (see bottom left):|
Profiling graph with digestion hacked to use 999999 instead of 1000000 as cap:
Also note in those graphs that checking caste flags approaches 8% CPU usage; it is very hard for me to estimate where most of those calls come, but it seems that checks for OPPOSED_TO_LIFE, CRAZED, and other CE_ADD_TAG affected ones amount to at least 50% of that. The simplest way to fix that is probably to cache those in another bitfield in the unit, so that active tag set could be computed simply as (base | added) & ~removed.
|Tags||No tags attached.|
Correct graph links:
|2012-05-30 03:59||ag||New Issue|
|2012-05-30 04:03||ag||Note Added: 0022787|
|2014-07-23 12:43||Toady One||Status||new => resolved|
|2014-07-23 12:43||Toady One||Fixed in Version||=> Next Version|
|2014-07-23 12:43||Toady One||Resolution||open => fixed|
|2014-07-23 12:43||Toady One||Assigned To||=> Toady One|
|Copyright © 2000 - 2010 MantisBT Group|