Difference between revisions of "User:Omei Qunhua"

From Second Life Wiki
Jump to navigation Jump to search
(Add sizing for x=0; x=-x;)
(More ByteCode sizes)
Line 4: Line 4:
<pre>
<pre>
The following are based on accessing a local integer variable
The following are based on accessing a local integer variable
(ordered by size)
Instruction      ByteCode size
Instruction      ByteCode size
(x);                  2
(x);                  2
(~x);                3
(~x);                3
x+x                  4
x=~x;                5
x=~x;                5
x=-x;                5
x=-x;                5
++x;                  6  
++x;                  6  
x=x+x                6   
x=-~x                6    equivalent to ++x
x=~-x                6    equivalent to --x
x = !x;              7
x = !x;              7
if (~x);              7
if (~x);              7   if (x != -1)
x++;                  8
x++;                  8
x=0;                  8
x=0;                  8
Line 17: Line 22:
x+=1;                10
x+=1;                10
x-=x;                10
x-=x;                10
x=x*2;                10
x*=2;                10
if(!~x)              10  if (x == -1)
x *= -1;              11
x *= -1;              11
x<<1;                12
x<<1;                12

Revision as of 07:37, 30 December 2012

Mono Code Size Measurements Results from my own tests in December 2012

The following are based on accessing a local integer variable
(ordered by size)
Instruction      ByteCode size
(x);                  2
(~x);                 3
x+x                   4
x=~x;                 5
x=-x;                 5
++x;                  6 
x=x+x                 6     
x=-~x                 6    equivalent to ++x
x=~-x                 6    equivalent to --x
x = !x;               7
if (~x);              7    if (x != -1)
x++;                  8
x=0;                  8
x=1;                  8
x+=1;                 10
x-=x;                 10
x=x*2;                10
x*=2;                 10
if(!~x)               10   if (x == -1)
x *= -1;              11
x<<1;                 12
if(x<0);              13
if(x==-1);            14
x=x<<1;               14

List storage Requirements in Mono These figures differ from those given in http://wiki.secondlife.com/wiki/LSL_Script_Memory Maybe Mono has been tightened up a bit.

Integer                   16 bytes each
Float                     16 bytes each
String                    18 each plus 2 bytes per character
Key (valid keys)
    (stored as keys)     102 bytes (!!) per key
Key (valid keys)
    (stored as strings)   90 bytes per key
(key) ""                  30 bytes
Vector                    24 bytes each   (correction, oops^^)
Rotation                  28 bytes each