tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r728084 - in /tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src: main/java/org/apache/tapestry5/corelib/components/Loop.java test/java/org/apache/tapestry5/corelib/components/LoopTest.java
Date Fri, 19 Dec 2008 18:06:24 GMT
Author: hlship
Date: Fri Dec 19 10:06:24 2008
New Revision: 728084

URL: http://svn.apache.org/viewvc?rev=728084&view=rev
Log:
TAP5-417: Tapestry 5.0 Performance Improvements
- Reduce number of render phases for the Loop component

Modified:
    tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java
    tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java

Modified: tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java?rev=728084&r1=728083&r2=728084&view=diff
==============================================================================
--- tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java
(original)
+++ tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java
Fri Dec 19 10:06:24 2008
@@ -332,7 +332,7 @@
      * Begins a new heartbeat.
      */
     @BeginRender
-    void begin()
+    void begin(MarkupWriter writer)
     {
         value = iterator.next();
 
@@ -352,15 +352,7 @@
         if (formSupport != null && volatileState) formSupport.store(this, ADVANCE_VOLATILE);
 
         startHeartbeat();
-    }
-
-    private void startHeartbeat()
-    {
-        heartbeat.begin();
-    }
 
-    void beforeRenderBody(MarkupWriter writer)
-    {
         if (element != null)
         {
             writer.element(element);
@@ -368,17 +360,19 @@
         }
     }
 
-    void afterRenderBody(MarkupWriter writer)
+    private void startHeartbeat()
     {
-        if (element != null) writer.end();
+        heartbeat.begin();
     }
 
     /**
      * Ends the current heartbeat.
      */
     @AfterRender
-    boolean after()
+    boolean after(MarkupWriter writer)
     {
+        if (element != null) writer.end();
+
         endHeartbeat();
 
         if (formSupport != null) formSupport.store(this, END_HEARTBEAT);

Modified: tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java?rev=728084&r1=728083&r2=728084&view=diff
==============================================================================
--- tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
(original)
+++ tapestry/tapestry5/branches/hlship-5.0-perf/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
Fri Dec 19 10:06:24 2008
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry5.corelib.components;
 
+import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.internal.test.InternalBaseTestCase;
 import org.apache.tapestry5.services.Heartbeat;
 import org.easymock.EasyMock;
@@ -28,6 +29,7 @@
     public void non_empty_iterator()
     {
         Heartbeat hb = mockHeartbeat();
+        MarkupWriter writer = mockMarkupWriter();
 
         // Really hard to test the exact timing of all this; it will have to
         // be "proven" by integration tests.
@@ -49,21 +51,21 @@
         assertTrue(loop.setup());
         assertEquals(loop.getIndex(), 0);
 
-        loop.begin();
+        loop.begin(writer);
         assertEquals(loop.getValue(), "alpha");
         assertEquals(loop.getIndex(), 0);
 
-        assertFalse(loop.after());
-        loop.begin();
+        assertFalse(loop.after(writer));
+        loop.begin(writer);
         assertEquals(loop.getValue(), "beta");
         assertEquals(loop.getIndex(), 1);
 
-        assertFalse(loop.after());
-        loop.begin();
+        assertFalse(loop.after(writer));
+        loop.begin(writer);
         assertEquals(loop.getValue(), "gamma");
         assertEquals(loop.getIndex(), 2);
 
-        assertTrue(loop.after());
+        assertTrue(loop.after(writer));
 
         verify();
     }



Mime
View raw message