function CSomeConstructor()
{
this.m_Item1 = 0;
this.m_Item2 = 0;
this.m_Item3 = 0;
this.m_Item4 = 0;
}
var someArray = new Array();
for (var i=0; i < 100; i++)
{
someArray[ i ] = new CSomeConstructor();
}
Not only would I be allocating memory each time through the loop for
CSomeConstructor(), but the array has to grow each time as well, which I'm
guessing is analagous to something like using a CString and concatenating
it, which cause a realloc each time and is therefore very slow.
Is there something like a "grow-by" or anything else that can make this type
of process more efficient ? Any help is appreciated.
Thanks,
Mike Gardipee
If the argument to the Array constructor is a single number, it is
interpreted as the new Array's length.
=-=-=
Steve
-=-=-
"mike gardipee" <mdgar...@doralsys.com> wrote in message
news:#RQSYaR5AHA.2052@tkmsftngp05...
var someArray = new Array(100)
creates an array object and assigns 100 to its length property, but does not
allocate memory for any elements. That's because all JScript arrays are
sparse.
Here is some further information that appears to be stolen directly from the
second edition of David Flanagan's book (I strongly encourage you to buy his
latest - 3rd - edition, which is a great read and still very relevant after
3 years):
http://hrg.dhtp.kiae.ru/corvin/webref/jscript/ch08_05.htm#ch08-SECT2-AUTOID.
4
"mike gardipee" <mdgar...@doralsys.com> wrote in message
news:#RQSYaR5AHA.2052@tkmsftngp05...
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Here's a little more detail just in case......
I'm grabbing a recordset, with say 1000 records in it in my Remote Script.
Since you can not return an ADODB Recordset directly from Remote Script, I'm
building a java script equivelant of a RS, which ultimately means I've got
an array of objects. Here's the thing that's so aggrevating. It takes about
1 second to get the actual Recordset via my ATL component, and then it takes
like 30 seconds to build up the Java-Equivelant Recordset. I'm looking for a
way to speed that up.
Thanks again.
Mike Gardipee
"Dave Anderson" <GTSPXO...@spammotel.com> wrote in message
news:#j8mJyU5AHA.1332@tkmsftngp04...