ID:1415526
 
(See the best response by Danny Roe.)
Code:
emitter
parent_type = /obj
var

_counter= 1
list
particle_count = new/list(25)
particleicon='Particles.dmi'
particleicon_state="fire"

particle
layer = MOB_LAYER+5
parent_type = /obj
blend_mode = BLEND_ADD

New()
..()
pixel_x=rand(7,9)
pixel_y=rand(5,7)
spawn()
src.Update()

proc/Update()
animate(src,transform=turn(matrix(),(rand(0,360))),time=25)
animate(src, transform=matrix()*0.985,pixel_y=rand(32,40),pixel_x=rand(-5,15),alpha=0,time=25)

sleep(world.tick_lag*100)
del(src)

proc/_Update()
var/tmp/pcount=0
for(var/obj/emitter/p in world)
for(var/mob/M in oview(p,5))
if(M.client)
pcount++
if(pcount>0)
var/particle/a = new/particle
a.dir=p.dir
a.icon=p.particleicon
a.icon_state=p.particleicon_state

p.particle_count[p._counter] = a
p._counter++
if (p._counter > 25)
p._counter = 1
a.loc=locate(p.x,p.y,p.z)


Problem description:
At the moment this takes up too much of the game's CPU for it to be utilized effectively and efficiently in a larger environment, I was wondering if anyone had any ideas on how to make it more efficient?
Best response
Ter13's Object Pools helped me cut down the CPU usuage of my particle effects.
Using Ter13's Object Pools library (or a similar system) may help out quite a bit.

With such a system in place, you avoid the constant creation and deletion of objects (which causes overhead), by creating what you need once, then moving them into and out of "storage" as necessary.
Ha!
I'll look into it, thanks for the heads up guys.