On 2008-12-19 17:01:48 -0500, "Bill Baxter" <[email protected]> said:

In addition to what other people have said, if you know the length the
array will be eventually you can preallocate by doing this:

float[] arr;
arr.length = N;
arr.length = 0;

The downside of reserving this way is that it'll initialize all the array elements you're reserving with a default value for no reason at all. I think reserve should be part of the language so we can avoid this.


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to