tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkemn...@apache.org
Subject tapestry-5 git commit: TAP5-2332: Optimize org.apache.tapestry5.internal.transform.EventHandlerMethodParameterSource.get(ComponentEvent, int) (~+30% reqs/second)
Date Sun, 07 Dec 2014 12:04:42 GMT
Repository: tapestry-5
Updated Branches:
  refs/heads/master 9b5e19035 -> d871f66b3


TAP5-2332: Optimize org.apache.tapestry5.internal.transform.EventHandlerMethodParameterSource.get(ComponentEvent,
int) (~+30% reqs/second)


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d871f66b
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d871f66b
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d871f66b

Branch: refs/heads/master
Commit: d871f66b38188bdc6a94290729a93279465fd81b
Parents: 9b5e190
Author: Jochen Kemnade <jkemnade@apache.org>
Authored: Sun Dec 7 13:03:19 2014 +0100
Committer: Jochen Kemnade <jkemnade@apache.org>
Committed: Sun Dec 7 13:03:19 2014 +0100

----------------------------------------------------------------------
 .../EventHandlerMethodParameterSource.java      | 27 ++++++++++++++------
 1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d871f66b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EventHandlerMethodParameterSource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EventHandlerMethodParameterSource.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EventHandlerMethodParameterSource.java
index a1a60ff..fd3a91b 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EventHandlerMethodParameterSource.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EventHandlerMethodParameterSource.java
@@ -27,6 +27,23 @@ import org.apache.tapestry5.runtime.ComponentEvent;
  */
 public class EventHandlerMethodParameterSource
 {
+    private static final class ParameterExtractor implements Invokable<Object> {
+        private final EventHandlerMethodParameterProvider[] providers;
+        private final int index;
+        private final ComponentEvent event;
+
+        private ParameterExtractor(EventHandlerMethodParameterProvider[] providers, int index,
ComponentEvent event) {
+            this.providers = providers;
+            this.index = index;
+            this.event = event;
+        }
+
+        public Object invoke()
+        {
+            return providers[index].valueForEventHandlerMethodParameter(event);
+        }
+    }
+
     private final String methodIdentifier;
 
     private final OperationTracker operationTracker;
@@ -46,13 +63,7 @@ public class EventHandlerMethodParameterSource
         // Hopefully this will not be too much overhead; it's really nice to be able to track
what parameter
         // caused a failure.
 
-        return operationTracker.invoke(String.format("Obtaining value for parameter #%d of
%s", index + 1, methodIdentifier),
-                new Invokable<Object>()
-                {
-                    public Object invoke()
-                    {
-                        return providers[index].valueForEventHandlerMethodParameter(event);
-                    }
-                });
+        return operationTracker.invoke("Obtaining value for parameter #" + (index + 1) +
" of "+ methodIdentifier,
+                new ParameterExtractor(providers, index, event));
     }
 }


Mime
View raw message