Benchmark
This commit is contained in:
parent
3d57a3929c
commit
ef9f9157f3
@ -147,7 +147,6 @@ public class JavaTXCompiler {
|
|||||||
|
|
||||||
final ConstraintSet<Pair> cons = getConstraints();
|
final ConstraintSet<Pair> cons = getConstraints();
|
||||||
|
|
||||||
System.out.println(cons);
|
|
||||||
String content = "";
|
String content = "";
|
||||||
content = ASPFactory.generateASP(cons, allClasses);
|
content = ASPFactory.generateASP(cons, allClasses);
|
||||||
final String tempDirectory = "/tmp/";
|
final String tempDirectory = "/tmp/";
|
||||||
|
@ -38,3 +38,4 @@ WS : [ \t\r\n\u000C]+ -> skip
|
|||||||
LINE_COMMENT
|
LINE_COMMENT
|
||||||
: '%' ~[\r\n]* -> skip
|
: '%' ~[\r\n]* -> skip
|
||||||
;
|
;
|
||||||
|
|
||||||
|
121
test/asp/unifywithoutwildcards/JavaTXCompilerASPBenchmark.java
Normal file
121
test/asp/unifywithoutwildcards/JavaTXCompilerASPBenchmark.java
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
package asp.unifywithoutwildcards;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.visual.ResultSetPrinter;
|
||||||
|
import de.dhbwstuttgart.typedeployment.TypeInsert;
|
||||||
|
import de.dhbwstuttgart.typedeployment.TypeInsertFactory;
|
||||||
|
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class JavaTXCompilerASPBenchmark {
|
||||||
|
|
||||||
|
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void finiteClosure() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"fc.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void lambda() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Lambda.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void lambda2() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Lambda2.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void lambda3() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Lambda3.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void mathStruc() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"mathStruc.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void generics() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Generics.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void genericsMethodCall() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
TestResultSet result = execute(new File(rootDirectory+"MethodCallGenerics.jav"));
|
||||||
|
//TODO: Hier sollte der Rückgabetyp der Methode String sein
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void faculty() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Faculty.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void facultyTyped() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"FacultyTyped.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void matrix() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Matrix.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void matrixTest() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"MatrixTest.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void packageTests() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Package.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void vector() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Vector.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void lambdaRunnable() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"LambdaRunnable.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void expressions() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"Expressions.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void addLong() throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
execute(new File(rootDirectory+"AddLong.jav"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class TestResultSet{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestResultSet execute(File fileToTest) throws IOException, ClassNotFoundException, InterruptedException {
|
||||||
|
List<String> results = new ArrayList<>();
|
||||||
|
for(int i = 0; i < 20; i++){
|
||||||
|
Date d1 = new Date();
|
||||||
|
JavaTXCompiler compiler = new JavaTXCompiler(fileToTest);
|
||||||
|
|
||||||
|
compiler.aspTypeInference();
|
||||||
|
|
||||||
|
Date d2 = new Date();
|
||||||
|
long seconds = (d2.getTime()-d1.getTime())/1000;
|
||||||
|
results.add("Total: "+seconds + " Sekunden");
|
||||||
|
}
|
||||||
|
for(String result : results){
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
return new TestResultSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
static String readFile(String path, Charset encoding)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
byte[] encoded = Files.readAllBytes(Paths.get(path));
|
||||||
|
return new String(encoded, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ class MyVector{
|
|||||||
|
|
||||||
id(x){
|
id(x){
|
||||||
Object i;
|
Object i;
|
||||||
|
|
||||||
x.add(i);
|
x.add(i);
|
||||||
x.add(i);
|
x.add(i);
|
||||||
x.add(i);
|
x.add(i);
|
||||||
@ -19,6 +20,8 @@ id(x){
|
|||||||
x.add(i);
|
x.add(i);
|
||||||
x.add(i);
|
x.add(i);
|
||||||
x.add(i);
|
x.add(i);
|
||||||
|
x.add(i);
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user