Difference between revisions of "Talk:Scripting Tutorial: My Second Script"
Talk:Scripting Tutorial: My Second Script (edit)
Revision as of 18:05, 19 June 2009
, 18:05, 19 June 2009→Section request
imported>Shademe (→Featured Nomination Discussion: Agreed) |
imported>Adderek |
||
Line 61: | Line 61: | ||
If this stuff has been covered already then feel free to remove or move this from the discussion. Instead please add a link or links to the relevent articles in your article. [[User:GuidoBot|GuidoBot]] 19:24, 19 October 2006 (EDT) | If this stuff has been covered already then feel free to remove or move this from the discussion. Instead please add a link or links to the relevent articles in your article. [[User:GuidoBot|GuidoBot]] 19:24, 19 October 2006 (EDT) | ||
== More section requests == | |||
I have checked the performance of scripts. It seems that every part of the condition is executed EVERY TIME! Please, add a note that "nested IF's could improve performance and the top-most checks should be least time consuming. | |||
My test script source had "If(x==#)&&(x==#)&&...&&(x==#) where # was either 0 or 1 and number of conditions was quite large (as well as executed objects in-game and repeats of the script). | |||
Results: | |||
(1) If(false) | |||
(2) If(true) | |||
(3) If(false)&&(false)&&...&&(false) | |||
(4) If(true)&&(true)&&...&&(true) | |||
(1) and (2) are fast | |||
(3) and (4) are slow | |||
It tells that no matter what you would do the conditions are always executed (in many scripting languages only the first false condition would be executed) and nested IF's should be used. My further tests confirmed that. |