tgstation/-tg-station — pull request #2234 by ChuckTheSheep (2014-01-04 08:25:36+00:00)
Title: Optimized Explosion v2

Could not edit first commit. Needed to fix oversights and add YotaXP's optimization he provided since it was explosion related.

Optimized explosion code with a simple edit/implementation of "trange()"
which is like range but it only handles turfs. Internally range goes
through all atoms, trange makes use of block() which only processes
turfs. Thus a less intensive implementation.

Also used the dist var being calculated and added spawn()s making the damage
happen from center outwards and the slight delays lets the code
"breathe" so to speak.

proc/explosion in profile:
Explosion with size (3, 5, 7, 0) "big bomb"

Before:
Self CPU: 0.006
Total CPU: 1.215
Real Time: 1.785
Calls: 1

After:
Self CPU: 0.002
Total CPU: 0.787
Real Time: 1.514
Calls: 1