Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old 12-09-2005, 01:02 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
It is being calculated slightly more than once every 0.05 seconds.
__________________
Reply With Quote
  #32  
Old 12-09-2005, 05:46 PM
Fox1545 Fox1545 is offline
Registered User
Join Date: Jul 2004
Posts: 78
Fox1545 is on a distinguished road
Quote:
Originally Posted by ApothiX
Your post was extremely vague, if you do not explain, then no one will understand what you meant.
But I already explained it.

Quote:
Is that supposed to raise your intelligence-rating?
It is supposed to show why I assumed that the people around me were clever enough to understand my point without the long explanation.

Quote:
For the record, I am an active member in the #gscript community
Oh yeah? Well, I am a founding member of the #gscript community

Can we argue the scripter-time-expense part more?
Reply With Quote
  #33  
Old 12-09-2005, 05:58 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Fox1545
But I already explained it.
Yes, After I had told you you were wrong.

Quote:
Originally Posted by Fox1545
Oh yeah? Well, I am a founding member of the #gscript community
And I can tell by the content of your posts the reason why you're not active any more.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #34  
Old 12-09-2005, 09:07 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
For the record, I went ahead and benchmarked this crap because you are all to lazy.

For expressions of numbers versus a single number out of 26 runs:
13 times the expression was faster
13 times the single number was faster

For expressions/single numbers (if you don't understand why I now group these, go away, you are stupid) versus a constant variable look-up in 26 runs:
1 time the constant look-up was faster
25 times the expression was faster

Now we must figure out the meaning of these results:
First, I ran these through 10 consecutive 10000 iteration loops, meaning this is a very extreme case. Second, the difference in timing was thus;
For the first test:
-average difference: .04 seconds
-smallest difference: .01 seconds
-largest difference: .1 seconds
For the second:
-average difference: .2 seconds
-smallest difference: .017 seconds
-largest difference: .37 seconds

None of these numbers are substantial given the context. So it is apparent that giving Graal an expression versus a computed expression makes no difference (as it is bytecoded, I am told by several very reputable sources). It is also true that while giving an expression is more efficient versus using a constant concerning CPU time. However, as Fox has already clarified, using a constant for recurring data is very beneficial to saving programmer time. If you do not understand this, you require more experience. When you use expressions only, and you need to change all instances of that expression in a complex code, then you will be thankful to have used a constant. This is governed by the inevitability that you will miss some instances and require debugging time just to change recurring data.

To summarise, using number expressions will benefit you by removing the abstractness of magic numbers(granted you want this). Using a constant to store recurring data in code will benefit you in programmer lookup and debugging time when you need to change that data.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial

Last edited by Dach; 12-09-2005 at 09:32 PM.. Reason: Now with non-estimated stats!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.