467,149 Members | 1,351 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,149 developers. It's quick & easy.

Multiple loops

Hi all,

I'm my script I've three loops processing a very huge data file. IE &
Firefox show a message box after some time saying my script could be
infinite looping and give me a chance to stop it.

Is there a way to prevent this dialog box to show up? I'm writing a
script used only on a intranet and the final customer should not see the
message box.

Thanks in advance,
Feb 6 '06 #1
  • viewed: 2638
Share:
6 Replies
Fabian Vilers wrote on 06 feb 2006 in comp.lang.javascript:
I'm my script I've three loops processing a very huge data file. IE &
Firefox show a message box after some time saying my script could be
infinite looping and give me a chance to stop it.

Is there a way to prevent this dialog box to show up? I'm writing a
script used only on a intranet and the final customer should not see the
message box.


Consider not using clientside scripting.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 6 '06 #2
Evertjan. wrote:
Consider not using clientside scripting.


Unfortunately, this is not an option.
Feb 6 '06 #3
Fabian Vilers wrote on 06 feb 2006 in comp.lang.javascript:
Evertjan. wrote:
Consider not using clientside scripting.


Unfortunately, this is not an option.


A programmer without technically necessary options
should decline the assignment!

In-browser javascript is not fitted for huge tasks.
[due to time and memory constraints]

Try:

A good database, w/cscript, compiled tasks like VB, c++, etc.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 6 '06 #4
Evertjan. wrote:
A programmer without technically necessary options
should decline the assignment!

In-browser javascript is not fitted for huge tasks.
[due to time and memory constraints]

Try:

A good database, w/cscript, compiled tasks like VB, c++, etc.


Thanks for your analysis Evertjan ;-) Like I said, I've no option. My
best choice for now on is to make big replace in a string :( (see other
post).

Thanks anyway
Feb 6 '06 #5
Fabian Vilers wrote:
I'm my script I've three loops processing a very huge data file. IE &
Firefox show a message box after some time saying my script could be
infinite looping and give me a chance to stop it.

Is there a way to prevent this dialog box to show up? I'm writing a
script used only on a intranet and the final customer should not see
the message box.


Since as you say not only using client-side scripting is not an option, I
think with unchanged code (see below) you will have to restrict your target
browser to Firefox and have your clients set this preference in their
user.js configuration file (or via `about:config'):

user_pref("dom.max_script_run_time", "0");

Setting this preference to 0 is specified to disable the warning. I have
set it to 60 (seconds) here.

I do not know if there is such a preference for IE, hence the Firefox
restriction.

However, you should definitely analyze the efficiency of your code,
especially of your loops, before you try anything else. For example,
using

/* a is an Array or collection object */
// order does not matter
for (var i = a.length; i--;)

or

// order does matter
for (var i = 0, len = a.length; i < len; i++)

is known to be faster than

for (var i = 0; i < a.length; i++)

Storing references of lookups from to the second level upwards in a (local)
variable and reusing that variable instead of looking up over and over
again (as was done in the first two examples) is another working means to
increase runtime efficiency, thus decreasing runtime.
HTH

PointedEars
Feb 6 '06 #6
Thomas 'PointedEars' Lahn wrote:
Fabian Vilers wrote:
["script too slow" warning in IE and Firefox]


Since as you say not only using client-side scripting is not an option, I
think with unchanged code (see below) you will have to restrict your
target browser to Firefox and have your clients set this preference in
their user.js configuration file (or via `about:config'):

user_pref("dom.max_script_run_time", "0");


Should be

user_pref("dom.max_script_run_time", 0);

of course.
PointedEars
Feb 6 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Jacek Generowicz | last post: by
1 post views Thread by Knocked Wood | last post: by
20 posts views Thread by km | last post: by
5 posts views Thread by john | last post: by
32 posts views Thread by tshad | last post: by
4 posts views Thread by Matt Ratliff | last post: by
13 posts views Thread by Joel Koltner | last post: by
5 posts views Thread by TP | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.