"There probably is a better way to do it. " Which is what i was getting at...... i hope "honest" isn't/wasn't taken as "insulting"
On Dec 30, 10:16 pm, "Michael Geary" <m...@mg.to> wrote: > Come on, MorningZ, there's no need for insults. > > But yes, 5000 of those will be pretty slow - and that's before you even > execute the code inside those functions. How slow? It's easy to test. The > ready functions are run in the order that the $() functions are called. So > simply do this in a test page: > > var t1 = +new Date; > $(function(){}); > // ... Repeat above line 5000 times > $(function() { > var t2 = +new Date; > alert( (t2-t1)/1000 + ' seconds' ); > }); > > You can easily generate that file by hand in a text editor. You don't have > to do 5000 pastes. Start with 10 of them, copy that block and paste it 10 > times so you have 100, copy *that* block and paste it 10 times so you have > 1000, copy that and five more pastes and you're done. > > Test it in IE6 (!), and if you're on your usual development machine, triple > the time from the alert to take into account the slower machines that your > visitors will have (think a slow laptop running on battery). If you don't > have IE6, try it in IE7 and as a rough guess, multiply your observed time by > six (triple for the slow machines, double again for IE6). > > Mind if I ask: why do you need 5000 of these? There probably is a better way > to do it. > > -Mike > > > From: MorningZ > > > If you've got 5000 of those, it's *seriously* time to > > reconsider your coding techniques..... depending on that > > much JavaScript is just plain old stupid...... > > On Dec 30, 8:59 pm, Kean <shenan...@gmail.com> wrote: > > > Is document ready "actually" an event handler? > > > > Let's say I have > > > > $(function(){ > > > > }); > > > > $(function(){ > > > > }); > > > > $(function(){ > > > > }); > > > > $(function(){ > > > > }); > > > > $(function(){ > > > > }); > > > > etc ..... around 5000 of those. > > > > Will it actually degrade performance like 5000 bind()? > > > My guess is not much performance penalty, but again, it's a guess.