In which the stoner one gets stoned and tries to address tick contention... again

Tick contention is when the mc, sleep()/spawns(), and byond internal processing fight each other for game tick time. Usually in an unproductive way that wastes cpu cycles and reduces the effective amount of game tick to go around.

Tweaked the anti-tick contention heuristics of the MC a touch.

Fixed an incorrect operator in the mc's anti-tick contention heuristics causing it to apply in times of no lag rather then times of lag.

The mc's anti-tick contention heuristics now plays better with the high pop processing mode.

We no longer reserve the tail end of a tick for the mc to have if the mc doesn't plan to run next tick because of high pop mode or anti-tick contention heuristics.

stoplag() can now be given an initial delay allowing it to act like a smarter sleep (in that it sleeps for longer if the server is overwhelmed.

All short sleeps that only existed for performance reason and had no game play, visual/audio, or balance reasons behind their timing were converted to stoplag().
This commit is contained in:
MrStonedOne
2017-10-09 01:21:43 -07:00
parent 4cadde240f
commit c8bb13d7c2
21 changed files with 72 additions and 54 deletions
+3 -3
View File
@@ -61,7 +61,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the
var/t = 0
var/timeout_time = (ASSET_CACHE_SEND_TIMEOUT * client.sending.len) + ASSET_CACHE_SEND_TIMEOUT
while(client && !client.completed_asset_jobs.Find(job) && t < timeout_time) // Reception is handled in Topic()
sleep(1) // Lock up the caller until this is received.
stoplag(1) // Lock up the caller until this is received.
t++
if(client)
@@ -112,7 +112,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the
var/t = 0
var/timeout_time = ASSET_CACHE_SEND_TIMEOUT * client.sending.len
while(client && !client.completed_asset_jobs.Find(job) && t < timeout_time) // Reception is handled in Topic()
sleep(1) // Lock up the caller until this is received.
stoplag(1) // Lock up the caller until this is received.
t++
if(client)
@@ -131,7 +131,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the
if (register_asset)
register_asset(file,files[file])
send_asset(client,file)
sleep(0) //queuing calls like this too quickly can cause issues in some client versions
stoplag(0) //queuing calls like this too quickly can cause issues in some client versions
//This proc "registers" an asset, it adds it to the cache for further use, you cannot touch it from this point on or you'll fuck things up.
//if it's an icon or something be careful, you'll have to copy it before further use.
+2 -3
View File
@@ -619,10 +619,9 @@ GLOBAL_LIST(external_rsc_urls)
/client/Stat()
. = ..()
if (holder)
sleep(1)
stoplag(1)
else
sleep(5)
stoplag()
stoplag(5)
//send resources to the client. It's here in its own proc so we can move it around easiliy if need be
/client/proc/send_resources()