I have a GWT applications, I would say it is moderate size. The
application runs great on FireFox, however when I use IE to browse my
application, it is dog-slow.
Here are few characteristics of my application:
- few ImageBundles
- no large tables
- i do have tree widgets, but each tree-widget only has a < 15
elements
- i do have flash chart components
- i do make RPC calls to populate contents of widgets on the web-
site
My question: how do I go about debugging speed issues with IE for my
application?
TIA,
Joster
Thanks. I have made the change, I don't notice much change, although I
don't have a way to quantify/measure the delta-change. Any other BKMs
(best-known methods)?
I do notice that IE downloads all the images every time I click within
my application even though I am using Image Bundles. Any ideas what
the issue might be?
Joster
On Oct 11, 7:06 pm, Peter Blazejewicz <peter.blazejew...@gmail.com>
wrote:
i am rendering a long table of contents returned by RPC calls, in FF
the delay is negligible, but in IE you can see the rows are rendered
row by row(yes, i do use incrementalcommand to render row by row,
otherwise, it will just take too much time and be not responsive to
the user )......
I think the problem must rely in the IE dom impl, so we can't do much
about it..
Also, since upgrading to 1.4.60 some images will randomly choose not
to load. Imagebundling images seems to fix this, but the oldschool
Images created with = new Image("images/image.png"), often don't work.
> > > > Joster- Hide quoted text -
>
> - Show quoted text -
I had a similar issue with IE. I had a dynamically loaded tree and it
took forever in IE6. I realized that an image bundle with the tree-
open.gif, tree_closed.gif images got repeatedly loaded. The thing is
that Tomcat and some other servers change the response headers so that
the web browser doesn't cache the images. In my case (Tomcat 5.5.20)
the solution was to add a filter that would add header "Cache-Control:
max-age=3600, public" to all GWT image responses.
You can read more in the GWT documentation:
http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.ImageBundle.html.
Regards,
Tony
I will attach the code I use. Then you start putting a lot of
Profiler.entry("functionname");
Profiler.leave();
stuff in you code, where you want to know profile info, and then well
you go and test it.
Drawbacks: requires code changes, you have to think to precede every
possible way a function can exit with Profiler.leave(); and you can
only profile down to 1ms a step, if the process is faster you have a
hard time. :(
-----------------------
package org.ace.acearea.client;
import java.lang.System;
import java.util.Vector;
import java.util.Stack;
public class Profiler {
public static Vector times = new Vector();
static Stack stack = new Stack();
static long begin = 0;
public static void enter(String routine) {
ProfileEntry e = new ProfileEntry(routine,
stack.size(), System.currentTimeMillis(), 0);
times.add(e);
stack.push(e);
}
public static void leave() {
long end = System.currentTimeMillis();
ProfileEntry e = (ProfileEntry) stack.pop();
e.end = end;
}
}
-----------------------------
package org.ace.acearea.client;
public class ProfileEntry {
public String name;
public int level;
public long begin;
public long end;
public ProfileEntry(String name, int level, long begin, long
end) {
this.name = name;
this.level = level;
this.begin = begin;
this.end = end;
}
}
------------------------
package org.ace.acedemo.client;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import org.ace.acearea.client.Profiler;
import org.ace.acearea.client.ProfileEntry;
import java.util.Stack;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class ProfilerDialog extends DialogBox {
Button okButton = new Button("OK");
VerticalPanel vz = new VerticalPanel();
Tree tree = new Tree();
public ProfilerDialog() {
super(false, false);
DOM.setStyleAttribute(getElement(), "zIndex", "100");
setWidget(vz);
vz.add(tree);
vz.add(okButton);
TreeItem ti = new TreeItem("Profile Linear"); // tree
item
for (int i = 0; i < Profiler.times.size(); i++) {
ProfileEntry e = (ProfileEntry)
Profiler.times.get(i);
TreeItem ni = new TreeItem(e.name + ": " +
(e.end - e.begin) + " (" + e.level + ")");
ti.addItem(ni);
}
tree.addItem(ti);
ti = new TreeItem("Profile Tree"); // tree item
TreeItem li = ti; // last item
// ni = new item
tree.addItem(ti);
Stack stack = new Stack();
for (int i = 0; i < Profiler.times.size(); i++) {
ProfileEntry e = (ProfileEntry)
Profiler.times.get(i);
if (e.level == stack.size()) {
TreeItem ni = new TreeItem(e.name + ":
" + (e.end - e.begin));
ti.addItem(ni);
li = ni;
} else if (e.level > stack.size()) {
TreeItem ni = new TreeItem(e.name + ":
" + (e.end - e.begin));
li.addItem(ni);
stack.push(ti);
ti = li;
li = ni;
} else {
while (e.level < stack.size()) {
ti = (TreeItem) stack.pop();
}
TreeItem ni = new TreeItem(e.name + ":
" + (e.end - e.begin));
ti.addItem(ni);
li = ni;
}
}
setText("Profiler");
setStyleName("bluebg");
okButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
hide();
}
});
}
}
---------------------------
On Oct 12, 3:29 pm, arozsypal <arozsy...@gmail.com> wrote:
> Hi Joster,
>
> I had a similar issue with IE. I had a dynamically loaded tree and it
> took forever in IE6. I realized that an image bundle with the tree-
> open.gif, tree_closed.gif images got repeatedly loaded. The thing is
> that Tomcat and some other servers change the response headers so that
> the web browser doesn't cache the images. In my case (Tomcat 5.5.20)
> the solution was to add a filter that would add header "Cache-Control:
> max-age=3600, public" to all GWT image responses.
>
> You can read more in the GWT documentation:http://code.google.com/webtoolkit/documentation/com.google.gwt.user.c....
On Oct 12, 9:29 am, arozsypal <arozsy...@gmail.com> wrote:
> Hi Joster,
>
> I had a similar issue with IE. I had a dynamically loaded tree and it
> took forever in IE6. I realized that an image bundle with the tree-
> open.gif, tree_closed.gif images got repeatedly loaded. The thing is
> that Tomcat and some other servers change the response headers so that
> the web browser doesn't cache the images. In my case (Tomcat 5.5.20)
> the solution was to add a filter that would add header "Cache-Control:
> max-age=3600, public" to all GWT image responses.
>
> You can read more in the GWT documentation:http://code.google.com/webtoolkit/documentation/com.google.gwt.user.c....
@lbmurai: Can you tell me what the dimensions and size of the
generated image bundle image are?
With regard to displaying PNG files using the Image widget, take a
look at this bug report: http://code.google.com/p/google-web-toolkit/issues/detail?id=1284
You mentioned that this problem only started happening for you when
you upgraded to GWT 1.4.60. Was there a previous version of GWT that
you were using in which you did not see this problem? If so, what
version?
Thanks,
Rajeev
Thanks for your help. I have been reading the documents and trying to
understand how to implement the cache-control filter.
As I understand, I need to do the following:
========= from a different thread in this forum ===================
) Make sure that clients don't cache the *.nocache.html file, since
when you recompile, you don't want a cached *.nocache.html file
referring to a no-longer-extant *.cache.html file. Use either "Pragma:
no-cache" or "Cache-Control" in your HTTP response header (the
to-be-written doc should give you some examples you can copy/paste).
3) Make sure that clients do cache the *.cache.html. In fact, GWT is
designed so that clients can safely cache these files forever. You can
do this with a far-in-the-future "Expires" or a "Cache-Control" age
header in the HTTP response. You'll really be glad if you configure
your server this way, because not only does the client not need to
download the compiled script again, it doesn't even need to ask
whether
it is fresh or not, which completely avoids an extra HTTP round-trip.
============================================================
My question:
- How do I do this?
- I need to add something to the WEB-INF/web.xml file, right?
- Could someone send some example snippets, please?
Joster
On Oct 12, 9:09 am, "gwt.team.rdayal" <gwt.team.rda...@gmail.com>
wrote:
<filter>
<filter-name>RequestFilter</filter-name>
<display-name>RequestFilter</display-name>
<filter-class>com.yourcompany.RequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Create the following servlet filter:
package com.yourcompany; // change this
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RequestFilter implements Filter
{
private static final String CACHE = ".cache.";
private static final String IMAGE_JPG = ".jpg";
private static final String IMAGE_PNG = ".png";
private static final String IMAGE_GIF = ".gif";
public void init(FilterConfig filterConfig) throws
ServletException {}
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws java.io.IOException, ServletException
{
HttpServletRequest hreq = (HttpServletRequest)request;
HttpServletResponse hres =
(HttpServletResponse)response;
String uri = hreq.getRequestURI();
// Set cache headers for GWT cache and images
if ( uri.indexOf(CACHE) != -1 || uri.endsWith(IMAGE_GIF) ||
uri.endsWith(IMAGE_JPG) || uri.endsWith(IMAGE_PNG) )
{
// cache for one year
hres.addHeader("Cache-Control","max-age=31556926");
}
chain.doFilter(request, response);
}
public void destroy()
{
}
}
> > > > - Show quoted text -- Hide quoted text -
I have only one imagebundle and that is very small, just the logo, a
few small-size icons. And no images are used in rendering the long
table....
The widgets in each row are somehow a bit complicated, having some
keylisteners, focuslisteners...
On Oct 13, 12:09 am, "gwt.team.rdayal" <gwt.team.rda...@gmail.com>
wrote:
On 12 Okt., 15:29, arozsypal <arozsy...@gmail.com> wrote:
> Hi Joster,
>
> I had a similar issue with IE. I had a dynamically loaded tree and it
> took forever in IE6. I realized that an image bundle with the tree-
> open.gif, tree_closed.gif images got repeatedly loaded. The thing is
> that Tomcat and some other servers change the response headers so that
> the web browser doesn't cache the images. In my case (Tomcat 5.5.20)
> the solution was to add a filter that would add header "Cache-Control:
> max-age=3600, public" to all GWT image responses.
>
> You can read more in the GWT documentation:http://code.google.com/webtoolkit/documentation/com.google.gwt.user.c....
> > - Show quoted text -- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -
@rdayal: Not really, but it's not much... I think the cache thing will
do it for me... On it... :)
> do it for me... On it... :)- Hide quoted text -