On 12/17/2015 04:39 AM, Robert Hanson wrote:
> Wow, what a GREAT FIND, Eric! Say you have a set of information in the form
> of an array for n items. Now you need to set the value for n+1. Well, of
> course you were efficient in your creating an array of just n values, so
> now you have to create a NEW array that is n+1 long instead of n long.
> That's pretty fast, if you do it once. But now do this:
>
> a = [];
> for (i = 0; i < 20000; i++) {
> if (a.length < i + 1)
> a = copyArray(a, i + 1);
> }
>
> See the problem? Not only are you creating an array that is 20000 long, you
> are creating a new array from an old one *20000 times. *Ouch!
>
Bob, I also tried to avoid this in Jmol scripting by setting the last
value of an array first:
var parsedData = [];
parsedData[tsvData.size] = 0;
Would you confirm that this will actually work?
Regards,
Rolf
--
Rolf Huehne
Postdoc
Leibniz Institute on Aging - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany
Phone: +49 3641 65 6205
Fax: +49 3641 65 6210
E-Mail: [email protected]
Website: http://www.leibniz-fli.de
Scientific Director: Prof. Dr. K. Lenhard Rudolph
Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Burkhard Zinner
VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users