Difference between revisions of "LSL Script Efficiency"
Jump to navigation
Jump to search
Line 23: | Line 23: | ||
The following code snipit will allow testing of a function. | The following code snipit will allow testing of a function. | ||
<pre> | |||
< | |||
default { | default { | ||
state_entry() { | state_entry() { | ||
integer i = 0; | integer i = 0; | ||
while (i < 1) { | while (i < 1) { | ||
++a; | |||
} | |||
} | |||
} | } | ||
</pre> | |||
</ | |||
---- | ---- | ||
Revision as of 13:09, 3 April 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
What is Efficiency
PAGE UNDER CONSTRUCTION!
Efficiency is how long it takes to run a script. For example, it is faster to do integer a = 3.1415926535 than integer a = PI. This is because it takes to computer time to determine the value for PI, and then set it to a.
For a similar reason, there are many random ways to speed up scripts, such as using ++a instead of a++.
Rules for posting
The following code snipit will allow testing of a function.
default { state_entry() { integer i = 0; while (i < 1) { ++a; } } }
Things that are faster
++a is the fastest then there is a += 1 finally a++