View Single Post
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-28-2016 , 00:34   Re: amxmodx profiler
Reply With Quote #120

Some benchmarks

Hi folks, I am here sharing some benchmarks.




Dynamic array

I did a benchmark between a static array and a dynamic array and I came here to share the results. It is just to see how big the difference could be. And as the same as tries and static arrays, you should use dynamic arrays, when it makes sense to it, i.e., they fit the well the problem solving.
Code:
date: Thu Jan 28 03:48:10 2016 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000009 / 0.000009 / 0.000009
   n |                  register_srvcmd |          1 | 0.000069 / 0.000069 / 0.000069
   n |                      ArrayCreate |          1 | 0.000002 / 0.000002 / 0.000002
   n |                    ArrayPushCell |         32 | 0.000002 / 0.000000 / 0.000000
   n |                       server_cmd |          1 | 0.000006 / 0.000006 / 0.000006
   n |                     ArrayGetCell |   32000000 | 2.712061 / 0.000000 / 0.009609
   p |                           cmd_go |          1 | 0.220705 / 0.220705 / 0.220705
   p |                      plugin_init |          1 | 0.000005 / 0.000005 / 0.000005
   f |                   UseStaticArray |    1000000 | 0.801795 / 0.000000 / 0.004913
   f |                  UseDynamicArray |    1000000 | 28.758015 / 0.000016 / 0.034018
0 natives, 0 public callbacks, 2 function calls were not executed.
This was the source code used:
Spoiler


is_user_connect

Looks like is better use 'is_user_connect' instead of cache it's value, because the diference seen insignificant.
Code:
date: Fri Jan 29 01:58:47 2016 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000011 / 0.000011 / 0.000011
   n |                  register_srvcmd |          1 | 0.000114 / 0.000114 / 0.000114
   n |                       server_cmd |          1 | 0.000008 / 0.000008 / 0.000008
   n |                is_user_connected |   32000000 | 2.580960 / 0.000000 / 0.014820
   p |                           cmd_go |          1 | 0.266977 / 0.266977 / 0.266977
   p |                      plugin_init |          1 | 0.000003 / 0.000003 / 0.000003
   f |               use_user_connected |    1000000 | 5.494115 / 0.000000 / 0.059881
   f |                 use_cached_value |    1000000 | 1.743552 / 0.000001 / 0.021680
0 natives, 0 public callbacks, 2 function calls were not executed.
This was the source code used:
Spoiler


cs_get_user_team

'cs_get_user_team' vs cached value benchmark.
Code:
date: Fri Jan 29 03:21:04 2016 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000009 / 0.000009 / 0.000009
   n |                  register_srvcmd |          1 | 0.000099 / 0.000099 / 0.000099
   n |                      get_players |          1 | 0.000003 / 0.000003 / 0.000003
   n |                 cs_get_user_team |   31000031 | 7.618567 / 0.000000 / 0.023226
   n |                       server_cmd |          1 | 0.000006 / 0.000006 / 0.000006
   p |                           cmd_go |          1 | 0.208685 / 0.208685 / 0.208685
   p |                      plugin_init |          1 | 0.000002 / 0.000002 / 0.000002
   f |                use_get_user_team |    1000000 | 8.162432 / 0.000000 / 0.016805
   f |                 use_cached_value |    1000000 | 1.997416 / 0.000002 / 0.003139
0 natives, 0 public callbacks, 2 function calls were not executed.
This was the source code used:
Spoiler


is_user_alive

'is_user_alive' vs cached value benchmark.
Code:
date: Fri Jan 29 03:34:38 2016 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000010 / 0.000010 / 0.000010
   n |                  register_srvcmd |          1 | 0.000099 / 0.000099 / 0.000099
   n |                      get_players |          1 | 0.000005 / 0.000005 / 0.000005
   n |                    is_user_alive |   31000031 | 2.379797 / 0.000000 / 0.002604
   n |                       server_cmd |          1 | 0.000007 / 0.000007 / 0.000007
   p |                           cmd_go |          1 | 0.199224 / 0.199224 / 0.199224
   p |                      plugin_init |          1 | 0.000003 / 0.000003 / 0.000003
   f |                   use_user_alive |    1000000 | 4.456642 / 0.000000 / 0.009792
   f |                 use_cached_value |    1000000 | 1.314150 / 0.000001 / 0.002849
0 natives, 0 public callbacks, 2 function calls were not executed.
This was the source code used:
Spoiler
Attached Files
File Type: sma Get Plugin or Get Source (arrays_benchmark.sma - 797 views - 1.3 KB)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-29-2016 at 00:36. Reason: spelling fix
addons_zz is offline