Hi,
Do any of you know how to calculate "Vertical Speed"?
Is it as something like (info.totalAscent + info.totalDescent) / info.timerTime?
Thanks,
Hi,
Do any of you know how to calculate "Vertical Speed"?
Is it as something like (info.totalAscent + info.totalDescent) / info.timerTime?
Thanks,
That's because you're using 100 numbers to initialize it. Try this and it's quite different, but the array is populated with the same values:
big=new [100]b;
for(var i=0;i<100;i++) {big[i]=i;}
I see a memory usage of 115 bytes and a few bytecodes for the loop..
Interesting! Not quite sure why it's different. Looks like a bug to me!
It's because you have 0 to 99 in your array definition, each of which takes space. I way I do it, I don't take that space.
I just create the byte array and populated it in the loop. If you drill down in the memory viewer and look at your BIG_ARRAY, it will also be only 115 bytes. The rest of the memory is due to how you defined it.
Using the same technique I previously used, I see that 93 bytes are required for the Array + 1 byte/element.
var big = new [100]b; for (var i=0; i < 100; i++) { big[i] = i; }
An array of 100 elements added 193 bytes while an array of 10 elements added 103 bytes.
You need to expand and look at the memory associated with the varibles. here big is is 100 in size, while ba is 8:
15 plus the size of the array.
Thinking about it the instruction "for (var i=0; i < 100; i++) { big[i] = i; }" is actually consuming memory, so if we remove it, I see 49 bytes for the Array + 1 byte/element. I believe we still have to consider the memory consumed by the instruction to declare the variable itself.
The following code required 500 bytes of memory.
10 array of 49 bytes = 490 bytes
10 element of 1 byte = 10 bytes
protected var big1 = new [1]b; protected var big2 = new [1]b; protected var big3 = new [1]b; protected var big4 = new [1]b; protected var big5 = new [1]b; protected var big6 = new [1]b; protected var big7 = new [1]b; protected var big8 = new [1]b; protected var big9 = new [1]b; protected var big10 = new [1]b;
Again, expand the memory view as I did at look at the memory for the variable itself.
That eliminates associated code, etc.
Take the "b" off
big=new [100]b; (so just big=new [100]) and check the memory used for that: 515 bytes.
I understand your point, but I was trying to see memory usage for the variable and the code itself, because that's really what's being used if I add this to the code. Every bytes count!