summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2009-11-17 15:55:06 +0000
committeraclement <aclement>2009-11-17 15:55:06 +0000
commit7e2347178129398ba119aba28f8d25545d44ca94 (patch)
tree092ff4d290beae3c9a8a138e89dacf030aae869c /org.aspectj.matcher
parent4ebeaac176bb61fec567f7f6b340a1375e499222 (diff)
downloadaspectj-7e2347178129398ba119aba28f8d25545d44ca94.tar.gz
aspectj-7e2347178129398ba119aba28f8d25545d44ca94.zip
speed test
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java52
1 files changed, 47 insertions, 5 deletions
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
index 433a44070..110137cf9 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
@@ -22,15 +22,11 @@ import org.aspectj.weaver.Member;
import org.aspectj.weaver.TestUtils;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.Bindings;
-import org.aspectj.weaver.patterns.FormalBinding;
-import org.aspectj.weaver.patterns.PatternParser;
-import org.aspectj.weaver.patterns.SignaturePattern;
-import org.aspectj.weaver.patterns.TestScope;
import org.aspectj.weaver.reflect.ReflectionWorld;
public class SignaturePatternTestCase extends PatternsTestCase {
+ @Override
public World getWorld() {
return new ReflectionWorld(true, this.getClass().getClassLoader());
}
@@ -65,7 +61,53 @@ public class SignaturePatternTestCase extends PatternsTestCase {
checkMatch(makeMethodPat("* *(..) throws *..IOException, !*..Clone*"), NONE, BOTH);
checkMatch(makeMethodPat("* *(..) throws !*..IOException"), NO_EXCEPTIONS, M);
}
+/*
+ public void testInstanceMethodMatchSpeed() throws IOException {
+ // Member objectToString = TestUtils.methodFromString("java.lang.String java.lang.Object.toString()");
+ Member objectToString = TestUtils.methodFromString(
+ "java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)").resolve(world);
+ SignaturePattern signaturePattern = makeMethodPat("* *(..))");
+ signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new FormalBinding[0]), new Bindings(0));
+ for (int i = 0; i < 1000; i++) {
+ boolean matches = signaturePattern.matches(objectToString, world, false);
+ }
+ long stime = System.currentTimeMillis();
+ for (int i = 0; i < 2000000; i++) {
+ boolean matches = signaturePattern.matches(objectToString, world, false);
+ }
+ long etime = System.currentTimeMillis();
+ System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
+ signaturePattern = makeMethodPat("* *())");
+ signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new FormalBinding[0]), new Bindings(0));
+ for (int i = 0; i < 1000; i++) {
+ boolean matches = signaturePattern.matches(objectToString, world, false);
+ }
+ stime = System.currentTimeMillis();
+ for (int i = 0; i < 2000000; i++) {
+ boolean matches = signaturePattern.matches(objectToString, world, false);
+ }
+ etime = System.currentTimeMillis();
+ System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
+ }
+
+ public void testInstanceMethodMatchSpeed2() throws IOException {
+ // Member objectToString = TestUtils.methodFromString("java.lang.String java.lang.Object.toString()");
+ Member objectToString = TestUtils.methodFromString(
+ "java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)").resolve(world);
+ SignaturePattern signaturePattern = makeMethodPat("!void *(..))");
+ signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new FormalBinding[0]), new Bindings(0));
+ for (int i = 0; i < 1000; i++) {
+ boolean matches = signaturePattern.matches(objectToString, world, false);
+ }
+ long stime = System.currentTimeMillis();
+ for (int i = 0; i < 2000000; i++) {
+ boolean matches = signaturePattern.matches(objectToString, world, false);
+ }
+ long etime = System.currentTimeMillis();
+ System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
+ }
+*/
public void testInstanceMethodMatch() throws IOException {
Member objectToString = TestUtils.methodFromString("java.lang.String java.lang.Object.toString()");
Member integerToString = TestUtils.methodFromString("java.lang.String java.lang.Integer.toString()");