Author: [EMAIL PROTECTED]
Date: Mon Nov 10 14:47:35 2008
New Revision: 4006

Modified:
     
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/HandlerManager.java
     
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java

Log:
Docs explaining enqueueAdd optimization

Modified:  
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/HandlerManager.java
==============================================================================
---  
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/HandlerManager.java
       
(original)
+++  
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/HandlerManager.java
       
Mon Nov 10 14:47:35 2008
@@ -102,6 +102,17 @@
     */
    public <H extends EventHandler> HandlerRegistration addHandler(
        GwtEvent.Type<H> type, final H handler) {
+
+    /*
+     * We used to keep the enqueue / dequeue entirely inside  
HandlerManager.
+     * However, we found a 30% speed improvement in handler registration if
+     * JsHandlerRegistry is allowed to make its own decision about  
queuing. Thus
+     * the funny code path here.
+     *
+     * No parallel optimization was made for removing handlers, as that
+     * rarely happens anyway, and is not a significant contributer to  
startup
+     * time.
+     */
      if (useJs) {
        javaScriptRegistry.addHandler(this, type, handler);
      } else {

Modified:  
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java
==============================================================================
---  
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java
    
(original)
+++  
branches/1_6_clean_events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java
    
Mon Nov 10 14:47:35 2008
@@ -55,7 +55,7 @@
      // flattened data structure, store the handlers in an external list
      // instead.
      if ((count == HandlerManager.EXPECTED_HANDLERS) & flattened) {
-      // As long as we are only adding to the end of a a handler list,  
should
+      // As long as we are only adding to the end of a handler list, should
        // not need to queue.
        if (manager.firingDepth > 0) {
          manager.enqueueAdd(type, myHandler);

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to