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!

Most of the time in Jmol, Miguel and I have taken great pains to make sure
we never did this. But, sure enough, that is what is happening in the
labels section.

A good challenge to find all these, and definitely a huge performance hit
-- and thus a potential performance gain when fixed....

Bob

​
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to