AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is normal to some functions to lag randomnly? (https://forums.alliedmods.net/showthread.php?t=132908)

01101101 07-19-2010 23:30

Is normal to some functions to lag randomnly?
 
Been playin around with the profiler, and seen some weird results about the mins/max.

For example, set_task

PHP Code:

name |      calls time min max
set_task 
|     104069 0.733546 0.000000 0.030394 

remove_task
PHP Code:

remove_task |       9527 0.710004 0.000000 0.012661 

operator/(_:,Float:)
PHP Code:

operator/(_:,Float:) |      71562 0.026303 0.000000 0.012143 

And many other cases

PD: What I mean is, those functions should take close to nothing of time, but you can see from the "max value" that sometimes it takes a long time to execute

Arkshine 07-20-2010 06:12

Re: Is normal to some functions to lag randomnly?
 
those functions should take close to nothing of time

And how you know ? Did you see the source code ? And you have a lot of calls in your exemple too.

01101101 07-20-2010 16:25

Re: Is normal to some functions to lag randomnly?
 
Quote:

Originally Posted by Arkshine (Post 1245384)
those functions should take close to nothing of time

And how you know ? Did you see the source code ? And you have a lot of calls in your exemple too.

How can a simple mathematical operation such as divide take 0.01 seconds?

Arkshine 07-20-2010 17:02

Re: Is normal to some functions to lag randomnly?
 
0.01 seconds ? You do 71562 calls with a total time of 0.026303 seconds. So for one call, 0.026303/71562 = ? second. I let you to find the answer. So you find it's slow... interesting.

01101101 07-20-2010 20:22

Re: Is normal to some functions to lag randomnly?
 
Quote:

Originally Posted by Arkshine (Post 1245965)
0.01 seconds ? You do 71562 calls with a total time of 0.026303 seconds. So for one call, 0.026303/71562 = ? second. I let you to find the answer. So you find it's slow... interesting.

I'm not talking about the average (thats what you are calculating)
I'm talking about the max (AFAIK the max is the execution which took the most time).

Arkshine 07-21-2010 06:10

Re: Is normal to some functions to lag randomnly?
 
What I'm calculating is the time for one call. To calculate the average I would need to have the 71562 times, adding them, then dividing by this one.

I don't know about the max, i remember reading it's something we should not care. In this situation, I would like to know how it can be useful.

ot_207 07-21-2010 06:23

Re: Is normal to some functions to lag randomnly?
 
The max value occurs when the server is processing something hard like entity visibility check or trace hull.
The chance of a function to take so long is so small that you can ignore it as Arkshine said.
Think that if you divide 0.733546 with 0.030394 you obtain something like 24.
So in 104069 calls a maximum of 24 are delayed so the number is too small if we compare them.
24/104069 = 2.31 * 10^(-4) this is the chance of a call to take so long. So it is too small.

Edit:
So yes it is normal for functions to lag randomly because the server has other stuff to process besides your plugin.

01101101 07-22-2010 17:07

Re: Is normal to some functions to lag randomnly?
 
Ok thanks


All times are GMT -4. The time now is 07:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.