Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is faster ?
Author Message
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #1
What is faster ?
Premise :
Values are "fixed", they range from 0 to 1000 with increments of 100.
What will be the faster way for sphere to assign a bonus that depends on those fixed "numbers" ?

PHP Code:
// Method 1 : A simple math formula
local.bonus = (<value> / 100)  * 3


// Method 2 : Using defnames
[DEFNAME bonus_calc]
bonus_0    0
bonus_100 3
bonus_200 6
bonus_300 9
bonus_400 12
..
bonus_1000 30

local
.bonus = <def.bonus_<value>> 
I think that the first seems faster Blush

Also i can't test it right now with the script profiler Shock
05-22-2013 02:49 AM
Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #2
RE: What is faster ?
I think second is marginally faster, but anyways two boths methods are pretty fast, the difference is almost zero.

I´ll use the first only for simplicity.
(This post was last modified: 05-22-2013 03:47 AM by Gil Amarth.)
05-22-2013 03:46 AM
Find all posts by this user Like Post Quote this message in a reply
Wap
Journeyman
*

Posts: 138
Likes Given: 6
Likes Received: 7 in 6 posts
Joined: Mar 2012
Reputation: 3

UORPG.net

Post: #3
RE: What is faster ?
Code:
[FUNCTION TESTSCPSPEED]
LOCAL.T=<SERV.RTICKS>
FOR I 0 <ARGV[0]>
    ...
ENDFOR
SYSMESSAGE @89,,1 Loop Time=<EVAL <SERV.RTICKS>-<LOCAL.T>>
RETURN 1
(This post was last modified: 05-22-2013 11:19 PM by Wap.)
05-22-2013 11:16 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #4
RE: What is faster ?
Nice i'll try that Big Grin ,

How much is reliable compared to the built in script profiler ?
05-22-2013 11:30 PM
Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #5
RE: What is faster ?
I have tried, it´s faster method 1...
05-23-2013 01:21 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)