Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2013-02-08 Thread tskardal
Thanks for sharing. Very interesting!

Is this issue still around with the latest version of GWT and IE?

On Monday, September 26, 2011 12:29:15 PM UTC+2, Rokesh Jankie wrote:

 Hi All,

 I've been working on GWT for a while now and noticed something important 
 and peculiar.
 In GWT you code in Java and almost automatically assume Java garbage 
 collection (because that's how you code).

 In this code sample: 
 http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls
 you'll see that the callback is created like the code snippet below. I 
 imagine that every GWT project will implement it like this.

 The Use Case: Fill data in the new CellTable widget. The size of the data 
 varied from 100 to 600 records.

 If the onSuccess results in a lot of data and this event/callback is 
 invoked lots of times (actually 3 to 5 times is enough) , on IE6, IE7,IE8 
 and IE9 there will be performance degradation. In other browsers
 like Chrome, Firefox and Safari there is no performance loss noticed. 

 After reading Joel Webber's note on Performance, I found out that it's not 
 the component (like the CellTable) that causes this behavior,
 but it was the callback creation. It seems that IE doesn't know how to 
 garbage collection the callback. So each time this new AsyncCallback is 
 performed,
 a memory leak occurred in IE browsers.

 Since the Callback is stateless, we decided to create the callback only 
 once  (*static *variable) and there was no performance loss anymore.
 After clicking for a while, the performance was the same (even after 
 inspecting the results of  some measurement tools).

 This worked for us and even IE6 is blazingly fast. IE9 is now even faster 
 that Chrome! No need for Chrome Frame Plugin (some organizations don't 
 allow Plugins at all, think about that!)

 Hopefully this tip works for you.

 And Yes we have GWT in production. That company's browser policy is to use 
 IE (now on 7, moving to 8). So this had to work or otherwise , it was a 
 huge showstopper!

 GWT applications do perform (even in older browsers), just make sure that 
 critical parts of your code are carefully reviewed (especially on the 
 new).



  AsyncCallback callback = new AsyncCallback() {
 public void onSuccess(Void result) {
   // do some UI stuff to show success
 }

 public void onFailure(Throwable caught) {
   // do some UI stuff to show failure
 }
   };

   // (3) Make the call...



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2012-10-12 Thread Rob
Hello can someone please help complete this sample. Maybe it is obvious to 
everyone out there but me but
callback c=createCallback();does not seem to work. Exactly how do I 
instantiate my call back.
Do I have to
static AsyncCallbackMYOBJECT  myCallback=null;
private AsyncCallbackMYOBJECT  create_myCallback() 
AsyncCallback? createCallBack(){

   if (myCallback==null){
 myCallback = new AsyncCallbackObject() {
   // implement onSuccess  
  //  implement onFailure
};
   
} // end iff
   return callback;
}   // end of  constructor

// Implementation
AsyncCallbackMYOBJECT  c=create_myCallback();
I guess so but then why the create mycallback when you meant 
AsyncCallbackMYOBJECT ???  Or am I missing something here?
because:
myCallback c=create_myCallback();   // does not work
So I am pretty sure you meant the former:
e.g 
AsyncCallbackMYOBJECT  c=create_myCallback();  
and not   
callback c = createCallback();


On Monday, September 26, 2011 11:36:55 AM UTC-4, Rokesh Jankie wrote:

 No definitely not: This is only with the callback Class (and in 
 combination with a lot of data).
 Somehow the callback is not garbage collected properly in IE.

 The GWT team covered this part (of (new ClickHandler)...)

 See this link 
 https://groups.google.com/forum/#!searchin/google-web-toolkit/clear$20memory$20IE7/google-web-toolkit/jPOhtj5vZT4/cOnK6MS_EQwJ

 And the last post of Joel Webber was definitely worth the read!

 So in short: Only the callback ( AsyncCallback()) class we changed to a 
 static class variable and that was it...No other code changes...

 Again: java garbage collection is (apparently) NOT the same as Javascript 
 garbage collection.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/OVNY8WJY3pcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2012-10-12 Thread Jens
You have a static variable that is instantiated when its needed (lazy 
instantiation).


private static AsyncCallbackPerson findPersonCallback;

private AsyncCallbackPerson createFindPersonCallback() {
  if(findPersonCallback == null) {
 findPersonCallback = new AsyncCallbackPerson() { 
 //.. implement . 
 }
  }
  return findPersonCallback;
}

public void fetchByName(String name) {
   AsyncCallbackPerson callback = createFindPersonCallback();
   personService.findByName(name, callback);
}

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/5aYliynDwSQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread Rokesh
Hi All,

I've been working on GWT for a while now and noticed something important and 
peculiar.
In GWT you code in Java and almost automatically assume Java garbage 
collection (because that's how you code).

In this code sample: 
http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls
you'll see that the callback is created like the code snippet below. I 
imagine that every GWT project will implement it like this.

The Use Case: Fill data in the new CellTable widget. The size of the data 
varied from 100 to 600 records.

If the onSuccess results in a lot of data and this event/callback is invoked 
lots of times (actually 3 to 5 times is enough) , on IE6, IE7,IE8 and IE9 
there will be performance degradation. In other browsers
like Chrome, Firefox and Safari there is no performance loss noticed. 

After reading Joel Webber's note on Performance, I found out that it's not 
the component (like the CellTable) that causes this behavior,
but it was the callback creation. It seems that IE doesn't know how to 
garbage collection the callback. So each time this new AsyncCallback is 
performed,
a memory leak occurred in IE browsers.

Since the Callback is stateless, we decided to create the callback only once 
 (*static *variable) and there was no performance loss anymore.
After clicking for a while, the performance was the same (even after 
inspecting the results of  some measurement tools).

This worked for us and even IE6 is blazingly fast. IE9 is now even faster 
that Chrome! No need for Chrome Frame Plugin (some organizations don't allow 
Plugins at all, think about that!)

Hopefully this tip works for you.

And Yes we have GWT in production. That company's browser policy is to use 
IE (now on 7, moving to 8). So this had to work or otherwise , it was a huge 
showstopper!

GWT applications do perform (even in older browsers), just make sure that 
critical parts of your code are carefully reviewed (especially on the 
new).



 AsyncCallback callback = new AsyncCallback() {
public void onSuccess(Void result) {
  // do some UI stuff to show success
}

public void onFailure(Throwable caught) {
  // do some UI stuff to show failure
}
  };

  // (3) Make the call...

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/3ZelaqGUGTcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread Juan Pablo Gardella
Thanks for share!!!

2011/9/26 Rokesh rjan...@gmail.com

 Hi All,

 I've been working on GWT for a while now and noticed something important
 and peculiar.
 In GWT you code in Java and almost automatically assume Java garbage
 collection (because that's how you code).

 In this code sample:
 http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls
 you'll see that the callback is created like the code snippet below. I
 imagine that every GWT project will implement it like this.

 The Use Case: Fill data in the new CellTable widget. The size of the data
 varied from 100 to 600 records.

 If the onSuccess results in a lot of data and this event/callback is
 invoked lots of times (actually 3 to 5 times is enough) , on IE6, IE7,IE8
 and IE9 there will be performance degradation. In other browsers
 like Chrome, Firefox and Safari there is no performance loss noticed.

 After reading Joel Webber's note on Performance, I found out that it's not
 the component (like the CellTable) that causes this behavior,
 but it was the callback creation. It seems that IE doesn't know how to
 garbage collection the callback. So each time this new AsyncCallback is
 performed,
 a memory leak occurred in IE browsers.

 Since the Callback is stateless, we decided to create the callback only
 once  (*static *variable) and there was no performance loss anymore.
 After clicking for a while, the performance was the same (even after
 inspecting the results of  some measurement tools).

 This worked for us and even IE6 is blazingly fast. IE9 is now even faster
 that Chrome! No need for Chrome Frame Plugin (some organizations don't allow
 Plugins at all, think about that!)

 Hopefully this tip works for you.

 And Yes we have GWT in production. That company's browser policy is to use
 IE (now on 7, moving to 8). So this had to work or otherwise , it was a huge
 showstopper!

 GWT applications do perform (even in older browsers), just make sure that
 critical parts of your code are carefully reviewed (especially on the
 new).



  AsyncCallback callback = new AsyncCallback() {
 public void onSuccess(Void result) {
   // do some UI stuff to show success
 }

 public void onFailure(Throwable caught) {
   // do some UI stuff to show failure
 }
   };

   // (3) Make the call...

  --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-web-toolkit/-/3ZelaqGUGTcJ.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread Magno Machado
interesting,

Would it be possible to implement this optimization at the compiler level,
so that programmers don't have to care about this? I mean, only on the IE
permutations, or for all permutations if it doesn't have negative effects on
other browsers

Not something specific to callback, but for anonymous classes in general

On Mon, Sep 26, 2011 at 8:32 AM, Juan Pablo Gardella 
gardellajuanpa...@gmail.com wrote:

 Thanks for share!!!


 2011/9/26 Rokesh rjan...@gmail.com

 Hi All,

 I've been working on GWT for a while now and noticed something important
 and peculiar.
 In GWT you code in Java and almost automatically assume Java garbage
 collection (because that's how you code).

 In this code sample:
 http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls
 you'll see that the callback is created like the code snippet below. I
 imagine that every GWT project will implement it like this.

 The Use Case: Fill data in the new CellTable widget. The size of the data
 varied from 100 to 600 records.

 If the onSuccess results in a lot of data and this event/callback is
 invoked lots of times (actually 3 to 5 times is enough) , on IE6, IE7,IE8
 and IE9 there will be performance degradation. In other browsers
 like Chrome, Firefox and Safari there is no performance loss noticed.

 After reading Joel Webber's note on Performance, I found out that it's not
 the component (like the CellTable) that causes this behavior,
 but it was the callback creation. It seems that IE doesn't know how to
 garbage collection the callback. So each time this new AsyncCallback is
 performed,
 a memory leak occurred in IE browsers.

 Since the Callback is stateless, we decided to create the callback only
 once  (*static *variable) and there was no performance loss anymore.
 After clicking for a while, the performance was the same (even after
 inspecting the results of  some measurement tools).

 This worked for us and even IE6 is blazingly fast. IE9 is now even faster
 that Chrome! No need for Chrome Frame Plugin (some organizations don't allow
 Plugins at all, think about that!)

 Hopefully this tip works for you.

 And Yes we have GWT in production. That company's browser policy is to use
 IE (now on 7, moving to 8). So this had to work or otherwise , it was a huge
 showstopper!

 GWT applications do perform (even in older browsers), just make sure that
 critical parts of your code are carefully reviewed (especially on the
 new).



  AsyncCallback callback = new AsyncCallback() {

 public void onSuccess(Void result) {

   // do some UI stuff to show success
 }

 public void onFailure(Throwable caught) {

   // do some UI stuff to show failure
 }
   };

   // (3) Make the call...

  --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-web-toolkit/-/3ZelaqGUGTcJ.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.




-- 
Magno Machado Paulo
http://blog.magnomachado.com.br
http://code.google.com/p/emballo/

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread ben fenster
so just to understand just replace anonymous in call callback with a
variable will fix the problem ?
instead of:
call(new callback(){});

use :
callback c = new callback(){};
call(c);

?



On Sep 26, 1:29 pm, Rokesh rjan...@gmail.com wrote:
 Hi All,

 I've been working on GWT for a while now and noticed something important and
 peculiar.
 In GWT you code in Java and almost automatically assume Java garbage
 collection (because that's how you code).

 In this code 
 sample:http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunicat...
 you'll see that the callback is created like the code snippet below. I
 imagine that every GWT project will implement it like this.

 The Use Case: Fill data in the new CellTable widget. The size of the data
 varied from 100 to 600 records.

 If the onSuccess results in a lot of data and this event/callback is invoked
 lots of times (actually 3 to 5 times is enough) , on IE6, IE7,IE8 and IE9
 there will be performance degradation. In other browsers
 like Chrome, Firefox and Safari there is no performance loss noticed.

 After reading Joel Webber's note on Performance, I found out that it's not
 the component (like the CellTable) that causes this behavior,
 but it was the callback creation. It seems that IE doesn't know how to
 garbage collection the callback. So each time this new AsyncCallback is
 performed,
 a memory leak occurred in IE browsers.

 Since the Callback is stateless, we decided to create the callback only once
  (*static *variable) and there was no performance loss anymore.
 After clicking for a while, the performance was the same (even after
 inspecting the results of  some measurement tools).

 This worked for us and even IE6 is blazingly fast. IE9 is now even faster
 that Chrome! No need for Chrome Frame Plugin (some organizations don't allow
 Plugins at all, think about that!)

 Hopefully this tip works for you.

 And Yes we have GWT in production. That company's browser policy is to use
 IE (now on 7, moving to 8). So this had to work or otherwise , it was a huge
 showstopper!

 GWT applications do perform (even in older browsers), just make sure that
 critical parts of your code are carefully reviewed (especially on the
 new).

  AsyncCallback callback = new AsyncCallback() {
     public void onSuccess(Void result) {
       // do some UI stuff to show success
     }

     public void onFailure(Throwable caught) {
       // do some UI stuff to show failure
     }
   };

   // (3) Make the call...

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread Rokesh Jankie
Almost there...


method doSomething (){


callback c = createCallback();


}


static AsyncCallback? callback = null;

AsyncCallback? createCallBack(){

   if (callback==null){
 callback = new AsyncCallbackObject() {
   // implement onSuccess  
  //  implement onFailure
}
   
}
   return callback;

}


Since we are keeping the callbacks stateless, this really improved 
performance on IE!

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/0Xvfkgn9RjcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread Nicolas Antoniazzi
Interresting. But in this case, is not it the same problem for all anonymous
classes ?
Do not you have this problem with event handler ?

myButton.addClickHanler(new ClickHandler() {
  public void onClick(ClickEvent e) {...}
}

2011/9/26 Rokesh Jankie rjan...@gmail.com

 Almost there...


 method doSomething (){


 callback c = createCallback();


 }


 static AsyncCallback? callback = null;

 AsyncCallback? createCallBack(){

if (callback==null){
  callback = new AsyncCallbackObject() {
// implement onSuccess
   //  implement onFailure
 }

 }
return callback;

 }


 Since we are keeping the callbacks stateless, this really improved
 performance on IE!

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-web-toolkit/-/0Xvfkgn9RjcJ.

 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Performance Tip for IE browsers : Java garbage collection is NOT Javascript garbage Collection

2011-09-26 Thread Rokesh Jankie
No definitely not: This is only with the callback Class (and in combination 
with a lot of data).
Somehow the callback is not garbage collected properly in IE.

The GWT team covered this part (of (new ClickHandler)...)

See this link 
https://groups.google.com/forum/#!searchin/google-web-toolkit/clear$20memory$20IE7/google-web-toolkit/jPOhtj5vZT4/cOnK6MS_EQwJ

And the last post of Joel Webber was definitely worth the read!

So in short: Only the callback ( AsyncCallback()) class we changed to a 
static class variable and that was it...No other code changes...

Again: java garbage collection is (apparently) NOT the same as Javascript 
garbage collection.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/rfRC1FZu3QMJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.