Skip to content

Commit d383320

Browse files
author
Max Stachon
committed
update CDSyn2SemDiffPerformanceTest
1 parent 8603804 commit d383320

File tree

1 file changed

+57
-38
lines changed

1 file changed

+57
-38
lines changed

cddiff/src/test/java/de/monticore/cddiff/syndiff/Performance.java renamed to cddiff/src/test/java/de/monticore/cddiff/syndiff/CDSyn2SemDiffPerformanceTest.java

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.junit.jupiter.api.Disabled;
1515
import org.junit.jupiter.api.Test;
1616

17-
public class Performance extends CDDiffTestBasis {
17+
public class CDSyn2SemDiffPerformanceTest extends CDDiffTestBasis {
1818

1919
@Test
2020
@Disabled
@@ -49,10 +49,12 @@ public void test() {
4949
List<ASTODArtifact> witnesses = syn2semdiff.generateODs(false);
5050
long endTime_new2 = System.currentTimeMillis(); // end time
5151

52-
System.out.println("old witness size: " + ods_old.size());
53-
System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms");
54-
System.out.println("new witness size: " + witnesses.size());
55-
System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms");
52+
System.out.println("Number of witnesses of Alloy-based CDDiff: " + ods_old.size());
53+
System.out.println("Runtime of of Alloy-based CDDiff: " + (endTime_old - startTime_old)
54+
+ "ms");
55+
System.out.println("Number of witnesses of CDSyn2SemDiff-based CDDiff: " + witnesses.size());
56+
System.out.println("Runtime of CDSyn2SemDiff-based CDDiff: " + (endTime_new2 - startTime_new2)
57+
+ "ms");
5658
}
5759
}
5860

@@ -89,10 +91,12 @@ public void test10() {
8991
List<ASTODArtifact> witnesses = syn2semdiff.generateODs(false);
9092
long endTime_new2 = System.currentTimeMillis(); // end time
9193

92-
System.out.println("old witness size: " + ods_old.size());
93-
System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms");
94-
System.out.println("new witness size: " + witnesses.size());
95-
System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms");
94+
System.out.println("Number of witnesses of Alloy-based CDDiff: " + ods_old.size());
95+
System.out.println("Runtime of of Alloy-based CDDiff: " + (endTime_old - startTime_old)
96+
+ "ms");
97+
System.out.println("Number of witnesses of CDSyn2SemDiff-based CDDiff: " + witnesses.size());
98+
System.out.println("Runtime of CDSyn2SemDiff-based CDDiff: " + (endTime_new2 - startTime_new2)
99+
+ "ms");
96100
}
97101
}
98102

@@ -129,20 +133,19 @@ public void test15() {
129133
List<ASTODArtifact> witnesses = syn2semdiff.generateODs(false);
130134
long endTime_new2 = System.currentTimeMillis(); // end time
131135

132-
System.out.println("old witness size: " + ods_old.size());
133-
System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms");
134-
System.out.println("new witness size: " + witnesses.size());
135-
System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms");
136+
System.out.println("Number of witnesses of Alloy-based CDDiff: " + ods_old.size());
137+
System.out.println("Runtime of of Alloy-based CDDiff: " + (endTime_old - startTime_old)
138+
+ "ms");
139+
System.out.println("Number of witnesses of CDSyn2SemDiff-based CDDiff: " + witnesses.size());
140+
System.out.println("Runtime of CDSyn2SemDiff-based CDDiff: " + (endTime_new2 - startTime_new2)
141+
+ "ms");
136142
}
137143
}
138144

139145
@Test
140146
@Disabled
141-
public void testOpenW() {
147+
public void testOpenWorldPerformance() {
142148
String path = "src/test/resources/validation/Performance/";
143-
144-
String output = "./target/runtime-test/";
145-
146149
String filePath1;
147150
String filePath2;
148151
for (int i = 1; i <= 5; i++) {
@@ -151,32 +154,48 @@ public void testOpenW() {
151154
System.out.println("******* Test for " + 5 * i + " *******");
152155

153156
CDSemantics cdSemantics = CDSemantics.STA_OPEN_WORLD;
154-
ASTCDCompilationUnit ast1_old = parseModel(filePath1);
155-
ASTCDCompilationUnit ast2_old = parseModel(filePath2);
156-
ASTCDCompilationUnit ast1_new = parseModel(filePath1);
157-
ASTCDCompilationUnit ast2_new = parseModel(filePath2);
158-
assertNotNull(ast1_old);
159-
assertNotNull(ast2_old);
160-
assertNotNull(ast1_new);
161-
assertNotNull(ast2_new);
157+
ASTCDCompilationUnit ast1 = parseModel(filePath1);
158+
ASTCDCompilationUnit ast2 = parseModel(filePath2);
159+
assertNotNull(ast1);
160+
assertNotNull(ast2);
162161

163162
// old method
164-
long startTime_old = System.currentTimeMillis(); // start time
165-
List<ASTODArtifact> ods_old = CDDiff.computeAlloySemDiff(ast1_old, ast2_old, 15, 5,
166-
CDSemantics.STA_OPEN_WORLD);
167-
long endTime_old = System.currentTimeMillis(); // end time
163+
long startTime_alloy = System.currentTimeMillis(); // start time
164+
List<ASTODArtifact> ods_alloy = CDDiff.computeAlloySemDiff(ast1.deepClone(), ast2.deepClone(),
165+
10, 1, CDSemantics.STA_OPEN_WORLD);
166+
long endTime_alloy = System.currentTimeMillis(); // end time
167+
168+
// old method
169+
long startTime_reduction = System.currentTimeMillis(); // start time
170+
ReductionTrafo trafo1 = new ReductionTrafo();
171+
ASTCDCompilationUnit ast1_tr1 = ast1.deepClone();
172+
ASTCDCompilationUnit ast2_tr1 = ast2.deepClone();
173+
trafo1.transform(ast1_tr1, ast2_tr1);
174+
List<ASTODArtifact> ods_old = CDDiff.computeAlloySemDiff(ast1_tr1, ast2_tr1, 10, 1,
175+
CDSemantics.STA_CLOSED_WORLD);
176+
long endTime_reduction = System.currentTimeMillis(); // end time
168177
// new method
169-
long startTime_new2 = System.currentTimeMillis(); // start time
170-
ReductionTrafo trafo = new ReductionTrafo();
171-
trafo.transform(ast1_new, ast2_new);
172-
Syn2SemDiff syn2semdiff = new Syn2SemDiff(ast1_new, ast2_new, 5, 15, true);
178+
long startTime_Syn2SemDiff = System.currentTimeMillis(); // start time
179+
ReductionTrafo trafo2 = new ReductionTrafo();
180+
ASTCDCompilationUnit ast1_tr2 = ast1.deepClone();
181+
ASTCDCompilationUnit ast2_tr2 = ast2.deepClone();
182+
trafo2.transform(ast1_tr2, ast2_tr2);
183+
Syn2SemDiff syn2semdiff = new Syn2SemDiff(ast1_tr2, ast2_tr2, 1, 10, true);
173184
List<ASTODArtifact> witnesses = syn2semdiff.generateODs(true);
174-
long endTime_new2 = System.currentTimeMillis(); // end time
185+
long endTime_Syn2SemDiff = System.currentTimeMillis(); // end time
175186

176-
System.out.println("old witness size: " + ods_old.size());
177-
System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms");
178-
System.out.println("new witness size: " + witnesses.size());
179-
System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms");
187+
System.out.println("Number of witnesses of purely Alloy-based method: " + ods_alloy.size());
188+
System.out.println("Runtime of of purely Alloy-based method: " + (endTime_alloy
189+
- startTime_alloy) + "ms");
190+
System.out.println(
191+
"Number of witnesses size of Reduction-based method with Alloy-based CDDiff: " + ods_old
192+
.size());
193+
System.out.println("Runtime of Reduction-based method with Alloy-based CDDiff: "
194+
+ (endTime_reduction - startTime_reduction) + "ms");
195+
System.out.println("Number of witnesses size of Reduction-based method with CDSyn2SemDiff: "
196+
+ witnesses.size());
197+
System.out.println("Reduction of Reduction-based method with CDSyn2SemDiff: "
198+
+ (endTime_Syn2SemDiff - startTime_Syn2SemDiff) + "ms");
180199
}
181200
}
182201

0 commit comments

Comments
 (0)