Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
proc overhead profiling
/proc/noop()
return
/mob
#define SECONDS *10
#define MINUTES SECOND*60
verb/testprocoverhead_enhanced()
var/end = world.timeofday+60 SECONDS
while (world.timeofday < end)
testprocoverhead_enhanced_chain()
proc/testprocoverhead_enhanced_chain(i=1)
var/static/const/num = 10
var/static/cur = rand(0, num-1)
if (prob(10))
cur = rand(0, num-1)
switch(cur)
if(0)
return i+testprocoverhead_enhanced_mob_empty()
if(1)
return i+testprocoverhead_enhanced_mob_1var()
if(2)
return i+testprocoverhead_enhanced_mob_5var()
if(3)
return i+testprocoverhead_enhanced_mob_1arg(i)
if(4)
return i+testprocoverhead_enhanced_mob_5arg(i, i++, i++, i++, i++)
if(5)
return i+testprocoverhead_enhanced_global_empty()
if(6)
return i+testprocoverhead_enhanced_global_1var()
if(7)
return i+testprocoverhead_enhanced_global_5var()
if(8)
return i+testprocoverhead_enhanced_global_1arg(i)
if(9)
return i+testprocoverhead_enhanced_global_5arg(i, i++, i++, i++, i++)
else
throw EXCEPTION("invalid chain state")
proc/testprocoverhead_enhanced_mob_empty()
noop()
proc/testprocoverhead_enhanced_mob_1var()
var/var1 = 1
noop(var1)
proc/testprocoverhead_enhanced_mob_5var()
var/var1 = 1
var/var2 = 2
var/var3 = 3
var/var4 = 4
var/var5 = 5
noop(var1+var2+var3+var4+var5)
proc/testprocoverhead_enhanced_mob_1arg(var1)
noop(var1)
proc/testprocoverhead_enhanced_mob_5arg(var1,var2,var3,var4,var5)
noop(var1+var2+var3+var4+var5)
/proc/testprocoverhead_enhanced_global_empty()
noop()
/proc/testprocoverhead_enhanced_global_1var()
var/var1 = 1
noop(var1)
/proc/testprocoverhead_enhanced_global_5var()
var/var1 = 1
var/var2 = 2
var/var3 = 3
var/var4 = 4
var/var5 = 5
noop(var1+var2+var3+var4+var5)
/proc/testprocoverhead_enhanced_global_1arg(var1)
noop(var1)
/proc/testprocoverhead_enhanced_global_5arg(var1,var2,var3,var4,var5)
noop(var1+var2+var3+var4+var5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.