-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTuneEverything.java
102 lines (89 loc) · 3.11 KB
/
TuneEverything.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import java.io.IOException;
/**
*
*/
public class TuneEverything {
public static void main(String[] args) {
int stringLength;
int iterations;
long time;
String path;
IntArray string=null;
BernoulliSubstring w;
SubstringIterator iterator;
// Parsing input
path="/Users/gustavedore/Projects/surprisingStrings_old/inputs/NC_021658.fna";
stringLength=14993299;
iterations=3;
// Initializing
int[] alphabet = new int[] {0,1,2,3};
try { string=Utils.loadDNA(path,stringLength,1000); }
catch(IOException e) {
e.printStackTrace();
System.exit(1);
}
w = new BernoulliSubstring(4,Utils.log2(4),Utils.bitsToEncode(4),string.length()+1,Utils.log2(string.length()+1),Utils.bitsToEncode(string.length()+1));
iterator = new SubstringIterator(string,alphabet,alphabet.length,w);
// LONGS_PER_REGION
System.gc();
System.out.println("LONGS_PER_REGION");
for (int l=0; l<=10; l++) {
Constants.LONGS_PER_REGION=1<<l;
time=System.currentTimeMillis();
for (int i=0; i<iterations; i++) iterator.run();
System.out.println(((double)(System.currentTimeMillis()-time))/iterations+" ");
}
Constants.LONGS_PER_REGION=2;
// LONGS_PER_REGION_CHARACTERSTACK
System.gc();
System.out.println("LONGS_PER_REGION_CHARACTERSTACK");
for (int l=0; l<=10; l++) {
Constants.LONGS_PER_REGION_CHARACTERSTACK=1<<l;
time=System.currentTimeMillis();
for (int i=0; i<iterations; i++) iterator.run();
System.out.println(((double)(System.currentTimeMillis()-time))/iterations+" ");
}
Constants.LONGS_PER_REGION_CHARACTERSTACK=2;
// LONGS_PER_REGION_POINTERSTACK
System.gc();
System.out.println("LONGS_PER_REGION_POINTERSTACK");
for (int l=0; l<=10; l++) {
Constants.LONGS_PER_REGION_POINTERSTACK=1<<l;
time=System.currentTimeMillis();
for (int i=0; i<iterations; i++) iterator.run();
System.out.println(((double)(System.currentTimeMillis()-time))/iterations+" ");
}
Constants.LONGS_PER_REGION_POINTERSTACK=2;
// N_STEALING_ATTEMPTS
System.gc();
System.out.println("N_STEALING_ATTEMPTS");
for (int l=1; l<=10; l++) {
Constants.N_STEALING_ATTEMPTS=l;
time=System.currentTimeMillis();
for (int i=0; i<iterations; i++) iterator.run();
System.out.println(((double)(System.currentTimeMillis()-time))/iterations+" ");
}
for (int l=15; l<=100; l+=5) {
Constants.N_STEALING_ATTEMPTS=l;
time=System.currentTimeMillis();
for (int i=0; i<iterations; i++) iterator.run();
System.out.println(((double)(System.currentTimeMillis()-time))/iterations+" ");
}
Constants.N_STEALING_ATTEMPTS=10;
// MAX_STRING_LENGTH_FOR_SPLIT, DONOR_STACK_LOWERBOUND
System.gc();
System.out.println("MAX_STRING_LENGTH_FOR_SPLIT, DONOR_STACK_LOWERBOUND");
for (int m=1; m<=20; m++) {
Constants.MAX_STRING_LENGTH_FOR_SPLIT=m;
for (int d=2; d<=20; d++) {
Constants.DONOR_STACK_LOWERBOUND=d;
time=System.currentTimeMillis();
for (int i=0; i<iterations; i++) iterator.run();
System.out.print(((double)(System.currentTimeMillis()-time))/iterations+" ");
}
System.out.println();
}
Constants.MAX_STRING_LENGTH_FOR_SPLIT=3;
Constants.DONOR_STACK_LOWERBOUND=2;
}
}