View Single Post
MeRcyLeZZ
Veteran Member
Join Date: Dec 2007
Old 03-19-2009 , 23:07   Re: Optimizing Plugins: Cache Results on a Larger Scale?
Reply With Quote #3

Quote:
Originally Posted by Brad
I'd reckon that in this case, if it's faster, it'd be that much better. With that in mind, you could do some benchmarks to see which method is faster and by what degree.
Results speak for themselves.

Test 1 - FM_PlayerPreThink forward

Normal:
Code:
date: Thu Mar 19 23:26:04 2009 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000004 / 0.000004 / 0.000004
   n |                 register_forward |          1 | 0.000010 / 0.000010 / 0.000010
   n |                    register_cvar |          1 | 0.000076 / 0.000076 / 0.000076
   n |                    get_pcvar_num |      18979 | 0.053471 / 0.000001 / 0.000456
   n |                      is_user_bot |      18979 | 0.263113 / 0.000003 / 0.000557
   n |                    is_user_alive |      18979 | 0.029252 / 0.000001 / 0.000208
   p |                fw_PlayerPreThink |      18979 | 0.119988 / 0.000003 / 0.001141
   p |                      plugin_init |          1 | 0.000004 / 0.000004 / 0.000004
0 natives, 0 public callbacks, 2 function calls were not executed.
Optimized:
Code:
date: Thu Mar 19 23:26:04 2009 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000002 / 0.000002 / 0.000002
   n |                   register_event |          1 | 0.000019 / 0.000019 / 0.000019
   n |                      RegisterHam |          2 | 0.000218 / 0.000054 / 0.000164
   n |                 register_forward |          1 | 0.000004 / 0.000004 / 0.000004
   n |                    register_cvar |          1 | 0.000006 / 0.000006 / 0.000006
   n |                         set_task |          1 | 0.000004 / 0.000004 / 0.000004
   n |                    get_pcvar_num |          2 | 0.000003 / 0.000001 / 0.000001
   n |                      is_user_bot |          1 | 0.000003 / 0.000003 / 0.000003
   n |                    is_user_alive |          3 | 0.000004 / 0.000001 / 0.000002
   n |                 cs_get_user_team |          2 | 0.000004 / 0.000002 / 0.000002
   p |                client_disconnect |          1 | 0.000002 / 0.000002 / 0.000002
   p |               client_putinserver |          1 | 0.000002 / 0.000002 / 0.000002
   p |                event_round_start |          2 | 0.000007 / 0.000003 / 0.000004
   p |                fw_PlayerPreThink |      18979 | 0.032394 / 0.000001 / 0.000389
   p |                   fw_PlayerSpawn |          3 | 0.000012 / 0.000003 / 0.000004
   p |                       plugin_cfg |          1 | 0.000002 / 0.000002 / 0.000002
   p |                      plugin_init |          1 | 0.000007 / 0.000007 / 0.000007
6 natives, 2 public callbacks, 9 function calls were not executed.
Test 2 - FM_AddToFullPack forward

Normal:
Code:
date: Thu Mar 19 23:42:00 2009 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000004 / 0.000004 / 0.000004
   n |                 register_forward |          1 | 0.000010 / 0.000010 / 0.000010
   n |                    register_cvar |          1 | 0.000076 / 0.000076 / 0.000076
   n |                    get_pcvar_num |    1641431 | 1.646760 / 0.000001 / 0.001176
   n |                      is_user_bot |    1641431 | 4.036367 / 0.000002 / 0.001273
   n |                    is_user_alive |    1641431 | 1.651495 / 0.000001 / 0.001062
   p |                 fw_AddToFullPack |    1641431 | 6.402578 / 0.000003 / 0.001015
   p |                      plugin_init |          1 | 0.000004 / 0.000004 / 0.000004
0 natives, 0 public callbacks, 2 function calls were not executed.
Optimized:
Code:
date: Thu Mar 19 23:42:00 2009 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000002 / 0.000002 / 0.000002
   n |                   register_event |          1 | 0.000011 / 0.000011 / 0.000011
   n |                      RegisterHam |          2 | 0.000153 / 0.000028 / 0.000125
   n |                 register_forward |          1 | 0.000003 / 0.000003 / 0.000003
   n |                    register_cvar |          1 | 0.000004 / 0.000004 / 0.000004
   n |                         set_task |          1 | 0.000005 / 0.000005 / 0.000005
   n |                    get_pcvar_num |          2 | 0.000003 / 0.000001 / 0.000002
   n |                      is_user_bot |          1 | 0.000003 / 0.000003 / 0.000003
   n |                    is_user_alive |          3 | 0.000004 / 0.000001 / 0.000002
   n |                 cs_get_user_team |          2 | 0.000004 / 0.000002 / 0.000002
   p |                client_disconnect |          1 | 0.000002 / 0.000002 / 0.000002
   p |               client_putinserver |          1 | 0.000002 / 0.000002 / 0.000002
   p |                event_round_start |          2 | 0.000007 / 0.000003 / 0.000004
   p |                 fw_AddToFullPack |    1641431 | 1.707666 / 0.000001 / 0.000867
   p |                   fw_PlayerSpawn |          3 | 0.000011 / 0.000003 / 0.000004
   p |                       plugin_cfg |          1 | 0.000002 / 0.000002 / 0.000002
   p |                      plugin_init |          1 | 0.000007 / 0.000007 / 0.000007
6 natives, 2 public callbacks, 9 function calls were not executed.
Guess I'll be having a busy week with ZP...


* Special thanks to sawce for his magnificent profiler.
__________________
MeRcyLeZZ is offline