excessive page faults

S

scotp

Does anyone know what would cause excessive page faults
running the js function below? The most common browser used
is IE 6. The page has records that include text & checkbox
inputs. Each record also has a hidden input named
"questions", whose value is an id that is used in the name
of inputs to be disabled. The number of page faults
increases dramatically as records increase. I know it is
the for loop that is taking the extra time, & generating the
faults, but I don't know why.

I counted page faults while deleting, and adding records:

Records Page Faults
150 350k+
117 178k
100 91k
75 36k
50 8k
24 518
10 2
20 177
30 670
40 1518
50 5631
60 8491
70 18k
80 32k
90 55k
100 87k
120 184k
150 420k


function disableWeights(fld)
{
//DISABLE Question weights & Point Basis when a section is
changed or a delete box is checked

var dis=false;
var frm=fld.form;
var fldName=fld.name;
var id=fldName.substr(fldName.lastIndexOf("_")+1);
var ques_lst=frm["questions"]; //array of question rowID's

if (fldName.substr(0,3)=="del")
{
if (fld.checked) frm.change.value++;
else frm.change.value--;
}

if (parseInt(frm.change.value)>0) dis=true;
frm.pointBasis.disabled=dis;

for (quesrow=0; quesrow<ques_lst.length; quesrow++)
{
if (ques_lst.length==1) qid=frm.questions.value;
else qid=ques_lst[quesrow].value;

q_type=frm["q_type_" + qid].value;
if (q_type!="Note")
{
frm["pt_weight_" + qid].disabled=dis;
}
}

return;
}
 
B

brunascle

Does anyone know what would cause excessive page faults
running the js function below? The most common browser used
is IE 6. The page has records that include text & checkbox
inputs. Each record also has a hidden input named
"questions", whose value is an id that is used in the name
of inputs to be disabled. The number of page faults
increases dramatically as records increase. I know it is
the for loop that is taking the extra time, & generating the
faults, but I don't know why.

I counted page faults while deleting, and adding records:

Records Page Faults
150 350k+
117 178k
100 91k
75 36k
50 8k
24 518
10 2
20 177
30 670
40 1518
50 5631
60 8491
70 18k
80 32k
90 55k
100 87k
120 184k
150 420k

function disableWeights(fld)
{
//DISABLE Question weights & Point Basis when a section is
changed or a delete box is checked

var dis=false;
var frm=fld.form;
var fldName=fld.name;
var id=fldName.substr(fldName.lastIndexOf("_")+1);
var ques_lst=frm["questions"]; //array of question rowID's

if (fldName.substr(0,3)=="del")
{
if (fld.checked) frm.change.value++;
else frm.change.value--;
}

if (parseInt(frm.change.value)>0) dis=true;
frm.pointBasis.disabled=dis;

for (quesrow=0; quesrow<ques_lst.length; quesrow++)
{
if (ques_lst.length==1) qid=frm.questions.value;
else qid=ques_lst[quesrow].value;

q_type=frm["q_type_" + qid].value;
if (q_type!="Note")
{
frm["pt_weight_" + qid].disabled=dis;
}
}

return;

}

ooo, ooo, i know, because IE's a piece of crap.

have you tried it in other browsers and had similar results?

i'd be interested to see how the results change with changes to the
for loop. i imagine it might have something to do with the
q_type=frm["q_type_" + qid] and frm["pt_weight_" + qid] parts. if,
before the for loop, you put all those values into two different array/
hash-table/collection things (one for q_type and one for pt_weight),
and used the qid as the keys, it might reduce the page faults.

if you could put all that q_type and pt_weight data into arrays before
the for loop, and worked with those arrays instead of the DOM, the
browser might be more likely to keep those arrays in memory.

i dont know, i'm just guessing.
 
S

scotp

Does anyone know what would cause excessive page
faults
running the js function below? The most common browser
used
is IE 6. The page has records that include text &
checkbox
inputs. Each record also has a hidden input named
"questions", whose value is an id that is used in the
name
of inputs to be disabled. The number of page faults
increases dramatically as records increase. I know it is
the for loop that is taking the extra time, & generating
the
faults, but I don't know why.

I counted page faults while deleting, and adding records:

Records Page Faults
150 350k+
117 178k
100 91k
75 36k
50 8k
24 518
10 2
20 177
30 670
40 1518
50 5631
60 8491
70 18k
80 32k
90 55k
100 87k
120 184k
150 420k

function disableWeights(fld)
{
//DISABLE Question weights & Point Basis when a section
is
changed or a delete box is checked

var dis=false;
var frm=fld.form;
var fldName=fld.name;
var id=fldName.substr(fldName.lastIndexOf("_")+1);
var ques_lst=frm["questions"]; //array of question
rowID's

if (fldName.substr(0,3)=="del")
{
if (fld.checked) frm.change.value++;
else frm.change.value--;
}

if (parseInt(frm.change.value)>0) dis=true;
frm.pointBasis.disabled=dis;

for (quesrow=0; quesrow<ques_lst.length; quesrow++)
{
if (ques_lst.length==1) qid=frm.questions.value;
else qid=ques_lst[quesrow].value;

q_type=frm["q_type_" + qid].value;
if (q_type!="Note")
{
frm["pt_weight_" + qid].disabled=dis;
}
}

return;

}

ooo, ooo, i know, because IE's a piece of crap.

have you tried it in other browsers and had similar
results?

i'd be interested to see how the results change with
changes to the
for loop. i imagine it might have something to do with the
q_type=frm["q_type_" + qid] and frm["pt_weight_" + qid]
parts. if,
before the for loop, you put all those values into two
different array/
hash-table/collection things (one for q_type and one for
pt_weight),
and used the qid as the keys, it might reduce the page
faults.

if you could put all that q_type and pt_weight data into
arrays before
the for loop, and worked with those arrays instead of the
DOM, the
browser might be more likely to keep those arrays in
memory.

i dont know, i'm just guessing.

I tried in Netscape (v6.2), the page took a long time to
load, but once it did, there was no delay when I clicked the
checkbox, and there were very few page faults.

In IE, with 150 records, the function takes approx 6 sec to
complete. But that is only for the first checkbox checked,
or the last checkbox un-checked. The second & subsequent
checks are (relatively) quick.

I don't know about building the arrays either, it seems like
xtra processing.
 
E

Erwin Moller

scotp said:
Does anyone know what would cause excessive page faults
running the js function below? The most common browser used
is IE 6. The page has records that include text & checkbox
inputs. Each record also has a hidden input named
"questions", whose value is an id that is used in the name
of inputs to be disabled. The number of page faults
increases dramatically as records increase. I know it is
the for loop that is taking the extra time, & generating the
faults, but I don't know why.

I counted page faults while deleting, and adding records:

Records Page Faults
150 350k+
117 178k
100 91k
75 36k
50 8k
24 518
10 2
20 177
30 670
40 1518
50 5631
60 8491
70 18k
80 32k
90 55k
100 87k
120 184k
150 420k


function disableWeights(fld)
{
//DISABLE Question weights & Point Basis when a section is
changed or a delete box is checked

var dis=false;
var frm=fld.form;
var fldName=fld.name;
var id=fldName.substr(fldName.lastIndexOf("_")+1);
var ques_lst=frm["questions"]; //array of question rowID's

if (fldName.substr(0,3)=="del")
{
if (fld.checked) frm.change.value++;
else frm.change.value--;
}

if (parseInt(frm.change.value)>0) dis=true;
frm.pointBasis.disabled=dis;

for (quesrow=0; quesrow<ques_lst.length; quesrow++)
{
if (ques_lst.length==1) qid=frm.questions.value;
else qid=ques_lst[quesrow].value;

q_type=frm["q_type_" + qid].value;
if (q_type!="Note")
{
frm["pt_weight_" + qid].disabled=dis;
}
}

return;
}

Hi,

Best thing to do is joining the real developers.
That is easy.
Download Firefox: www.getfirefox.com
Load your page, and look in the errorconsole and see what goes wrong (tools
-> errorconsole).

If that isn't enough I advise installing the FF add-on named firebug (via
tools-> add on) and select 'get addons' , then install firebug (under
'advised addons' or something like that).
(I think you must restart FF after installing)

With firebug you can get detailed errordescriptions and can even debug your
JavaScript with breakpoints, look into variables at runtime, change
code(!), etc.

Be sure to read through the introduction on how to use it.
(A link to it can be found on the addon page of FF)

And when you are at it: Keep developing in FF, and just use IE to check if
things work in that piece of insecure buggy unreliable crap.

Regards,
Erwin Moller
 

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top