ss13-daedalus / daedalus

A custom SS13 fork.
GNU General Public License v3.0
15 stars 7 forks source link

Investigate uses of spawn() that should be sleep() #28

Open sunfall opened 12 years ago

sunfall commented 12 years ago

I strongly suspect that a number of uses of spawn() in the code (which generate new "processes," whatever that means in BYOND) should really be sleep()s, which don't, and therefore incur less processing overhead.

Note that the surrounding code almost certainly /should/ be a spawn(), as sleep() blocks callers, but once a single subprocess has been kicked off there's generally no reason to make subsequent spawn() calls unless they really do need to operate independently.

Locations known to warrant investigation (update as necessary):

ghost commented 12 years ago

Spawn should really be used for things kicked off by the gameticker, and stuff like Atmos which are processor intensive.

sunfall commented 12 years ago

Right. There /should/ be some number of "sub-processes" (however BYOND defines those) dealing with things in-game, but a lot of spawn()s have subsequent sub-spawn()s, which doesn't usually make a lot of sense. The autolathe is a clear example: you don't want the game to hang until the autolathe is done with its construction, but internal to the autolathe itself there's no reason it needs to keep spawning subprocesses.

ghost commented 12 years ago

I most certainly agree with that. There is lots of bad code, on TOP of the ultra-bad goon code. On Jun 2, 2012 10:07 AM, "Phil Bordelon" < reply@reply.github.com> wrote:

Right. There /should/ be some number of "sub-processes" (however BYOND defines those) dealing with things in-game, but a lot of spawn()s have subsequent sub-spawn()s, which doesn't usually make a lot of sense. The autolathe is a clear example: you don't want the game to hang until the autolathe is done with its construction, but internal to the autolathe itself there's no reason it needs to keep spawning subprocesses.


Reply to this email directly or view it on GitHub: https://github.com/ss13-daedalus/daedalus/issues/28#issuecomment-6079095