wood burning stoves 2.0*
The moose likes GWT and the fly likes GWT slowness problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT slowness problem" Watch "GWT slowness problem" New topic
Author

GWT slowness problem

Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
I am displaying 843 rows x 8 columns (one date string and 7 ints) from my database using a Table from Google Visualization. I get the data through RPC (List)
The problem with it that it takes about 10 seconds to refresh. If i reorder it clicking on the columns it even freezes the browser for 10 seconds.
What can i do to make it faster?
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

hmm, first of all, 843x8=6744 is a very large number, however, having so many cells in a table in html would usually
not hinder performance to that extent...

however data processing on the other hand can hinder the performance. how exactly are you retrieving data ?[formatted / raw ]
are you doing any processing on the data being retrieved or are you directly displaying the data on screen ?

a browser freeze usually occurs when thre is too much processing going on in the javascript code.

My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
P.S. What is your site made in (http://www.salvin.in), seems gadgets except they have no placeholders?

The large number of cells does not hinder HTML at all, as i was displaying it using JSP at first with under a second delay (unnoticeable).
Also the data itself is not an issue, the response is: 31.8 KB (32,626 bytes)

The process through which i display is through RPC, populating a list of beans through a simple ORM code, which i iterate and set the GWT Visualization Table Widget DataTable object.
Basicly i replicated this article method: http://www.ibm.com/developerworks/opensource/library/os-ad-gwt3/
Reflection might be the issue here.

This Table Widget has the functionality of sorting data as is, with javascript, and this is the reason for freezing; javascript is not suited for large operations (or so i read).
What i aim to eliminate though is the slowness of loading (although asynchronous it's annoying).

I already been given an answer on a mailing list in the form of:
http://www.ibm.com/developerworks/web/library/wa-aj-patterns/index.html
which seems a very good article, which i'll try later on, i believe it will fix my problem of loading the page. Don't know about the freezing part yet, the usual solution for processing problems is eliminate the processing (send more data as is after processing server side - but in the world of web development, sending more data over the internet is not a good solution). An optimization of the ideea i just described would be giving an array of the 'id' column coresponding to every other column, reordered in the order that a certain filtering would give (ascending or descending) - eg the filter would be if the string column needs be the factor of reordering, an underlying array of id values that would reorder the table after itself (not doing a sort comparing strings but reordering the table after the preordering of IDs coresponding to the strings).
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

maybe you could do the sort operation at the server.

you are right in saying that its unwise to use javascript to do large complex operations.
Its advisible to make a dumb client that does not do operations such as sorting, filtering, etc.
those can be done at the server.

@ my site, i sent you a pm...
Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
First time i see javascript's slowness in action though. The whole browser thing needs burning down and starting from scratch. I'm considering WPF(XBAP) and Silverlight after this again.
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

silverlight requires your client to have a plugin installed,
GWT just requires javascript to be enabled,
consider this portability when thinking of changing your entire technology altogether.

Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
I'm not changing it, in the words of duke nukem: "i'm an equal oportunity ass kicker".
I'm doing all this for a portofolio, so my goal is to intermingle all the newest technologies.
I'm already doing struts 2 + GWT. Silverlight would be nice instead of flash for a banner for instance, or doing some animation since that's its strong point, beeing a light version of WPF. Speaking of which, WPF through XBAP can port desktop applications to the browser (enabling you to truly build real games if you wished to).

The real issue is the intrinsic problems it arises from each technology, XBAP has a loading issue, since it can be big, but only relative to the content in can do, so it's best for intranet high quality media on windows. Silverlight is a nice all rounder alternative to Flash. These guys are best for banners, flash enabled sites really kill my PC, i hate that. GWT is a good framework for building sites with medium quality graphics and its portability boosts it a long way. The fact that you can write Java instead of AJAX enabled javascript makes it a winner from the get go, not fogetting about the optimizations it does and building for different browsers automatically (which would really annoy me if i was doing plain javascript). Pointing out that there is a best tool for every situation, only bosses don't seem to figure that out always
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

Are you testing using a stand alone instance, such as GWT running on Jetty, or are you using the Eclipse-based plugin server? I find the stand alone server runs a lot better than the compatibility mode test app the plugin uses.


My Blog: Down Home Country Coding with Scott Selikoff
Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
I don't understand. I do debugging in hosted mode and i deploy on tomcat (using eclipse to publish), then i see the result in FF and IE7 (or in Eclipse's embedded browser).
I notice it being slow in the production phase.

I don't have time to do the optimizations, i set aside a bunch of techniques for later, to wich i linked above. One other issue as i pointed out is the lack of proper ORM.
I used this (which uses reflection), to populate a list of beans representing the rows:



When i looked at the code generated, the result is bloated out from the table's functionality, which i will trim down since i probably don't need it all.
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

Tudor Andrei Raneti wrote:don't seem to figure that out always


Here is what one of my clients said:

I dont care whether you use java/pava technology or bullet technology, I just want it to show the output I am expecting.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10170
    
    8

Maybe you want to consider using speedtracer to figure out the bottlenecks?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
Well, the client doesn't pay for a technologies primer, it's his prerogative to ask and receive what he's paying for.

As for speedtracer, isn't that just for chrome? Kind of annoying that i have to get yet another browser.

I've been looking into Vaadin in the meantime, looks good, and hopefully the controls already "stream" the data in, hopefully.
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

Maneesh Godbole wrote:Maybe you want to consider using speedtracer to figure out the bottlenecks?


I agree with maneesh godbole, we too used speed tracer to figure out bottlenecks with code output style as "DETAILED" in GWT.
The best solution is Firebug, it profile result returns "own time" - Time spent by a function Excluding nested calls.
That is the best statistic you can look at !

I wish speed tracer did the same
paul stockley
Greenhorn

Joined: Jan 07, 2010
Posts: 1
Have you tried the Bulk table renderer from the gwt-incubator project?

http://code.google.com/p/google-web-toolkit-incubator/
Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
I switched to Vaadin, it comes with ready made lazy loading in its table controls.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: GWT slowness problem
 
Similar Threads
converting a double to a String
Problem with JDBC
CMP performance
Miliceconds + Group By (Interval of 5 Seconds)
CallableStatement and ResultSet - Performance Issue