ID:1134413
 
(See the best response by Jemai1.)
Problem description:

Which is more efficient?

Keeping lots of useless mobs on game(There useless so their no harm)

Or constantly deleting those mobs.

I once had a problem with random mobs being created so I made it where everytime someone logs on they automatically delete useless mobs. That's causing the CPU to go up fast, but when they were just hanging around there was also lag so which would be better at this moment
Best response
The best course of action is to trace and stop the cause of randomly appearing mobs.
When the mobs just hang around, it costs RAM.
And also some cpu when you're looping through mobs in world.

When you delete them, it's costing you cpu sure.

Obviously the best solution is to simply trace where they are coming from.
But if you have lag, it might not be from the mobs.
How do you trace exactly? Is it a new function because I heard FireKing say something about TRACE(), but when I go to dreammaker and click help it's not there.
No. There's no such function. You need to track down what's causing the problem. Investigate your game. Add debug messages. Note when these mobs appear. Is it at log in? Is it when I load a savefile? Maybe when I kill a mob, it spawns another mob and does not delete itself. Look at every possible scenario. Sooner or later, you'll find out what's causing it.

Like what they say, prevention is better than cure.
mob
New()
..()
spawn(300)
if(src.name=="mob")
world<<"Name: [src]"
world<<"Loc: [src.x],[src.y],[src.z],[src.loc]"
world<<"I was here [test12]"
test12+=1
var
tmp/test12=1

When using this I could tell that 89 useless mobs were created before I even logged on and that they were all in 0,0,0 which I think is a void. I found all my new/mob paths, but none of them were created in void or called mob because I would attach something to it.
var/mob/T=new/mob/InnerSelf//or the name of the mob

Also there was 1 useless mob after I logged in.(It tells you every 30 secs)
Is it constantly rising when you are doing nothing? If so, you better check out the procs that run on background. For example, your ai, Stat(), etc.

If not, check the procs that were run on or before you logged in / loaded your character.