0

I am working on a project on a very simple website with 5 pages. Each page is a GWT Widget (UI Binder). I am currently creating objects of all 5 Widgets, when i load the Base Presenter, where i handle all History Token Change Events. The Problem is, the website is really slow to load in Development Mode. When hosted in AppEngine its much better in speed. How can i overcome this Issue.

Earlier i used to create objects on request. ie., if a user clicks a link, i will create the object of that Widget and display it. But if he comes back to previous page and clicks the same link again, it will create a new object and the old objects memory is not cleared (since it is not java after compiling). This is why i created all Objects at the Beginning.

I don't know where i have went wrong. Can anyone please suggest me a suitable technique to overcome this issue.

Vijay Sarin
  • 1,326
  • 1
  • 11
  • 31
  • I think you want to speed up your compiler: http://stackoverflow.com/questions/1011863/how-do-i-speed-up-the-gwt-compiler – Jama A. Jan 12 '12 at 13:15

2 Answers2

3

You are asking two independent questions:

  1. Development Mode is slow:
    Well Development Mode will be always slower than Production Mode because of the required overhead of marshaling and unmarshaling Java objects into Javascript and vice versa in Development mode.
    However various browsers perform differently. Because of how Chrome's plugin system works Development Mode in Chrome is much slower than in Firefox or Safari (see here for more details). So I would recommend to use Firefox for debugging until this issue is fixed.

  2. Clearing memory of unused objects:
    This has nothing to do with Java vs Javascript.
    Javascript engines do have garbage collectors and memory for "unused" objects will be released as soon as the object is garbage collected. However you have to make sure that you don't have any references to the unused objects anymore.
    Did you confirm that you have a memory leak?

Ümit
  • 17,379
  • 7
  • 55
  • 74
  • Hi Ümit, Thanks for the quick response. When the Application is in production mode, i have seen a decrease in performance of the browser. I am Not sure about Memory Leaks in my Application. Also, i have worked in Firefox but still sometimes i feel chrome is much better. – Vijay Sarin Mar 07 '12 at 05:19
  • You can use the Developer Tools of Chrome to make snapshot of the memory usage/heap size of your app. If this the heap size constantly increases during the app's lifetime than you might have a memory leak. Check [this](http://code.google.com/chrome/devtools/docs/heap-profiling-dom-leaks.html) and [this](http://gent.ilcore.com/2011/08/finding-memory-leaks.html) for more details – Ümit Mar 07 '12 at 07:54
1

JS leaks are quite well handled by GWT. Read this. http://code.google.com/intl/ca/webtoolkit/articles/dom_events_memory_leaks_and_you.html

ramon_salla
  • 1,587
  • 1
  • 17
  • 35