I was surprised seeing that array copying is done as
b = merge( a, [] ) in place of b = a.concat();:
shouldn't the latter be faster?
The problem with .concat() is that a is not always an array. It is often a
NodeList returned from getElementsByTagName() or childNodes. You might think
that
I've got a jquery script where I append (one by one) 50 new
jquery objects to another jquery object, but it's taking way
too much time, so I thought that it could be faster if I make
an array buffer out of them and then aggregate the array
as a whole, but I don't find out how to do it.
Can
I have got an array of 50 urls templates, and want to make a proper url out
of each one, adding also a special click, and then append all these urls to
a div in a specific position. All this should be done many times in a page,
many could be 50, just to say something that could be possible, but
I just put a time start / end probes and found that each 50 times append loop
eats up almost 500 milliseconds.
Between 465 and 515 on IE7 and between 500 and 575 on FF1.5.0.8
This means that a page with 10 loops, needs 5 seconds to end displaying!!
AND I was wrong before, each link is inside 2
From: Andrea Ercolino
I have got an array of 50 urls templates, and want to make a
proper url out of each one, adding also a special click, and
then append all these urls to a div in a specific position.
All this should be done many times in a page, many could be
50, just to say
mea culpa
I made a 'mistake': I put in the loop an accessor $( .class ) that caused
the abnormal delay.
After saving the reference $class = $( .class ) before entering the loop,
the delay has lowered to 78 milliseconds in IE7 AND 78 milliseconds in
FF1.5.0.8: unbelievable!
you can save
Andrea Ercolino schrieb:
mea culpa
I made a 'mistake': I put in the loop an accessor $( .class ) that caused
the abnormal delay.
After saving the reference $class = $( .class ) before entering the loop,
the delay has lowered to 78 milliseconds in IE7 AND 78 milliseconds in
FF1.5.0.8: