Heya,
I'm developing a small compiler for JavaScript and wondering if someone
could point out which is the most efficient way to handle array memory in
V8. Currently, if array needs regular push/pops I will manually extend
length and store numElements in additional variable (some what similar how
std::vector works internally), like:
*var array = new Array(2);var numElements = 0;var add = [ 1, 2, 3,
4]if(add.length + numElements > array.length) { array.length = **add.length
+ numElements**; *
*}*
*for(var i = 0; i < add.length; i++) {*
* array[numElements++] = add[i];*
*}*
Or this is handled internally and i'm doing additional work?
If i'm - does creating an array with capacity of 100000 and then resize it
to only 1000 capacity will this create hidden "semi-memory leak"?
If it will not, how V8 determines when to change capacity of an array
internally?
Thanks
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.