phpnuke 7.3 slowness
Koos Vriezen
koos.vriezen at xs4all.nl
Thu Sep 2 18:33:14 BST 2004
Hi,
Looking why phpnuke has become so slow, I found that it does
var htmlArea = new Array(20);
var j=0;
for (i=1;i<document.all.length;i++) {
if (document.all(i).tagName=="TEXTAREA") {
htmlArea[j]=document.all(i).name;
j=j+1;
}
}
I managed to turn this, for our site, in
var htmlArea = new Array(20);
var textareas = document.getElementsByTagName("TEXTAREA");
var j=textareas.length;
for (i=1;i<j;i++) {
if (1 ) {
htmlArea[i]=textareas(i).name;
}
}
uglyness, which made this page 8x faster. Now I could only bug PHPNuke about
this, but IE does this much faster (so does Mozilla, but that's because
it bails out with a script error :-)
The 'document.all' in the 'for' and 'if' looks to be the culprit. Quite
some time ago, before 3.1, there was some talk about speeding up these
collection things. Is anybody working on this still?
One idea might be that elements for document.all, and .applets, .forms,
.whatever, should register themselves on attach (and deregister on
detach) at document wide tables. Caching a collection, might be another
one, though dangerous of course. Thoughts, ideas, ..
Koos
More information about the kfm-devel
mailing list