Java gwt a script makes browser run slow

I have a web application written in java gwt. When opening a website in IE8, there is always a message that says "A script on this page causes your web browser to start slowly" The message only appears in IE8 without a higher version, not in FF or Chrome!

Since the application is written in java gwt, it is quite difficult to debug the javascript code, is there another way to identify the problem?

Does the application also have a lot of asynchronous calls that might occur on the database?

+3


source to share


3 answers


This message means that JavaScript has been blocking the browser thread for a long time.

Its implementation in IE8 is really silly. It counts the number of lines of JavaScript code (instructions) that it executes, and if it reaches a certain threshold, this message is displayed.

Actually this limit is configurable in the Windows registry, by default it is 5,000,000 or something. This can be increased, which is of course not the recommended solution.



One way to avoid this message is to use GWT's DeferredCommand. If you could split the work you are doing into chunks small enough not to trigger IE8's security limitation, you'll be fine. Also try to combine multiple asynchronous requests as much as possible and improve the rendering of the logic by potentially moving from Widgets to UI Binder or plain DOM.

This is a related question ( Disabling long-running-script message in Internet Explorer )

+9


source


I would disagree a little - "java gwt its quite difficult to debug javascript code"

The MSDN article for disabling the slow warning script only hides the problem.

The slow script warning comes when you have a heavy loop or deep recursive call. This can happen in two scenarios -

1) Poorly coded client side processing logic - example tree navigation
2) Deep object graph in rpc.

      

You can quickly isolate the problem if you are familiar with

1) Using Speed ​​Tracer - https://developers.google.com/web-toolkit/speedtracer/



2) Using GWT Log - https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging

3) Using Chrome Dev Tools and Firebug for timeline capture, profiling, etc.

4) IE8 has profiling, but it's damn slow and unwieldy.

5) Use GWT Pretty mode instead of OBF mode when profiling.

Once you are sure which part of the code is causing the slow script Just FIX it .

+1


source


Since some scripts may take too long to start up, Internet Explorer prompts the user to decide if they will continue with the slow script.

If Javascript Generated Cache.js file is that large this message may appear.

So, in the message box for Internet Explorer versions 4.0, 5.0, 6, 7 and 8, the message appears

Read this article on the MS blog

And write below the question

a script on this page calls something that is slow

0


source







All Articles