Hi,
I have a Jersey-Guice backend delivering some data to my gwt application for graphing. The object returned is a JSON object delivered as JSONP (has to be cross-site). The object contains a couple of simple fields and a map. For my testing, the map has 3 elements in it. Each element of the map is a List of 850 objects, let's call them MyValue. The MyValue has two properties, a double and a java.util.Date.
Currently I'm deserializing them as shown below.
My question is this: in development mode, the process of converting the JSONObject to a json string is insanely slow. With my Map<String, ListMyValue>> of 3 entries of 850 rows, the serializing process is about 40 seconds on a Core 2 Duo 2.4 running linux, using Chromium as the browser. (GWT version is 2.4).
My guess is that it's not the size of the object but the number of items. I'm wondering if this is due to object creation churn as the string is built by creating string objects and appending them, meaning >2500 create-and-copy operations.
Questions:
1) If that's the case, is there anything I can do about it?
2) Is what I"m seeing typical?
public void onSuccess(JavaScriptObject jso) {
AutoBean<IHistoricalReport> report;
if (GWT.isProdMode()) {
/*
* In production mode, cast the JavaScriptObject
* to a Splittable and convert
*/
GWT.log("Production Mode");
Splittable splittable = (Splittable) jso;
GWT.log("decoding");
report = AutoBeanCodex.decode(beanFactory,
IHistoricalReport.class,
splittable);
} else {
/*
* In development mode, have to make a json string
* then decode from that
*/
GWT.log("Development Mode");
JSONObject jObj = new JSONObject(jso);
String json = jObj.toString();
GWT.log("decoding");
report = AutoBeanCodex.decode(beanFactory,
IHistoricalReport.class,
json);
}
}
});
--Chris