User:Pedro Oval/Mono code memory usage

From Second Life Wiki
< User:Pedro Oval
Revision as of 13:22, 8 February 2013 by Pedro Oval (talk | contribs) (Saving work in progress)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Here are some memory usage results I've obtained with Mono, for common language constructs. They were obtained by replicating each line to test 512 times and looking at llGetFreeMemory right at the beginning of the script.

Results for local integer variables x, y, and local float variables f, g:

Construct Bytes used Comments
; 0
{} 0
x 2
-x 3
~x 3
!x 5
--x 6 Pre-decrement
++x 6 Pre-increment
x-- 8 Post-decrement
x++ 8 Post-increment
x=y 4 Assignment
x==y 5 Comparison
x+y 4
x-y 8 !?!?
x*y 4
x/y 8
x&y 4 Bitwise
x&&y 4 Logical
x*y 4
x*y 4
x*y 4
;;  0.000000
return;  1.000000
x;  2.000000
(x);  2.000000
(integer)x;  2.000000
(float)x;  3.000000
(float)x;  0.000000
f;  2.000000
(float)f;  2.000000
(integer)f;  7.000000
f=x;  5.000000
f=(float)x;  5.000000
!x;  5.000000
-x;  3.000000
~x;  3.000000
++x;  6.000000
--x;  6.000000
x++;  8.000000
x--;  8.000000
x+y;  4.000000
x-y;  8.000000
x*y;  4.000000
x/y;  8.000000
x%y;  8.000000
x+-y;  5.000000
x<<y;  8.000000
x>>y;  8.000000
x<y;  5.000000
x<=y;  8.000000
x>y;  5.000000
x>=y;  8.000000
!(x<y);  8.000000
-x<-y;  7.000000
x==y;  5.000000
x!=y;  8.000000
x&y;  4.000000
x^y;  4.000000
x|y;  4.000000
x&&y;  13.000000
x||y;  10.000000
x=y;  4.000000
x+=y;  6.000000
x-=y;  10.000000
x*=y;  6.000000
x/=y;  10.000000
x%=y;  10.000000
x=x+y;  6.000000
x=x-y;  10.000000
x=x*y;  6.000000
x=x/y;  10.000000
x=x%y;  10.000000
if(x);  6.000000
if (x);else;  11.000000
if (x) x;else y;  15.000000
if (x) x;  8.000000
if (x) x; else;  13.000000
if (x) x; else x;  15.000000