Skip to content

Commit 29dc36b

Browse files
committed
Improved analysis tool
1 parent 8d969e5 commit 29dc36b

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

src/test/java/org/fastfilter/analysis/AnalyzeResults.java

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import java.io.LineNumberReader;
77
import java.util.ArrayList;
88
import java.util.Arrays;
9-
import java.util.Collections;
109
import java.util.HashMap;
10+
import java.util.Locale;
1111
import java.util.function.Function;
1212

1313
/**
@@ -81,11 +81,12 @@ public class AnalyzeResults {
8181
int randomAlgorithm;
8282
boolean warning;
8383
String[] dataLine;
84-
static String[] algorithmNames = new String[100];
84+
static String[] algorithmNames = new String[200];
8585
ArrayList<Data> allData = new ArrayList<>();
8686
ArrayList<Data> data = new ArrayList<>();
8787

8888
public static void main(String... args) throws IOException {
89+
Locale.setDefault(Locale.ENGLISH);
8990
new AnalyzeResults().processFile();
9091
}
9192

@@ -102,6 +103,7 @@ private void processFile() throws IOException {
102103
|| line.startsWith("Using")) {
103104
continue;
104105
}
106+
line = line.replaceAll(" \\(addall\\)", "_addAll");
105107
String[] list = line.split(" +");
106108
if (Character.isDigit(line.charAt(0)) && line.indexOf(" size ") >= 0) {
107109
processEntry();
@@ -158,6 +160,21 @@ private void processFile() throws IOException {
158160
System.out.println("\\end{tabular}");
159161
System.out.println("\\end{table}");
160162

163+
System.out.println("=== minimum =====");
164+
System.out.println("\\begin{table}[]");
165+
System.out.println("\\small");
166+
System.out.println("\\begin{tabular}{lrrrr}");
167+
System.out.println("\\hline");
168+
System.out.println("Name & Lookup (25\\% find) & Bits/key & FPP & Million keys \\\\");
169+
System.out.println("\\hline");
170+
combineData(10);
171+
listMinimum();
172+
combineData(100);
173+
listMinimum();
174+
System.out.println("\\hline");
175+
System.out.println("\\end{tabular}");
176+
System.out.println("\\end{table}");
177+
161178
// printQueryTimeVersusSpaceUsage();
162179
// printQueryTimeVersusFPP();
163180
// printFppVersusSpaceOverhead();
@@ -171,7 +188,7 @@ private void processFile() throws IOException {
171188
static class Data {
172189
int algorithmId;
173190
int randomAlgorithm;
174-
double add, find0, find25, find50, find75, find100;
191+
double add, remove, find0, find25, find50, find75, find100;
175192
double e, bitsItem, optBitsItem, wastedSpace, keysMillions;
176193
boolean failed;
177194

@@ -297,17 +314,18 @@ private void processEntry() {
297314
return;
298315
}
299316
data.add = Double.parseDouble(dataLine[1]);
300-
data.find0 = Double.parseDouble(dataLine[2]);
301-
data.find25 = Double.parseDouble(dataLine[3]);
302-
data.find50 = Double.parseDouble(dataLine[4]);
303-
data.find75 = Double.parseDouble(dataLine[5]);
304-
data.find100 = Double.parseDouble(dataLine[6]);
305-
data.e = Double.parseDouble(dataLine[7].substring(0, dataLine[7].length() - 1));
306-
data.bitsItem = Double.parseDouble(dataLine[8]);
307-
data.optBitsItem = Double.parseDouble(dataLine[9]);
308-
data.wastedSpace = Double.parseDouble(dataLine[10].substring(0, dataLine[10].length() - 1));
317+
data.remove = Double.parseDouble(dataLine[2]);
318+
data.find0 = Double.parseDouble(dataLine[3]);
319+
data.find25 = Double.parseDouble(dataLine[4]);
320+
data.find50 = Double.parseDouble(dataLine[5]);
321+
data.find75 = Double.parseDouble(dataLine[6]);
322+
data.find100 = Double.parseDouble(dataLine[7]);
323+
data.e = Double.parseDouble(dataLine[8].substring(0, dataLine[8].length() - 1));
324+
data.bitsItem = Double.parseDouble(dataLine[9]);
325+
data.optBitsItem = Double.parseDouble(dataLine[10]);
326+
data.wastedSpace = Double.parseDouble(dataLine[11].substring(0, dataLine[11].length() - 1));
309327
data.failed = warning;
310-
double keys = Double.parseDouble(dataLine[11]);
328+
double keys = Double.parseDouble(dataLine[12]);
311329
if (keys != data.keysMillions) {
312330
throw new AssertionError();
313331
}
@@ -499,4 +517,20 @@ void listAll() {
499517
}
500518
}
501519

520+
void listMinimum() {
521+
sortByName(data);
522+
for(Data d : data) {
523+
String name = algorithmNames[d.algorithmId];
524+
if (name.endsWith("-addAll")) {
525+
continue;
526+
}
527+
System.out.println(name +
528+
" & " + Math.round(nanosPerKey(d.find25)) +
529+
" & " + String.format("%.1f", d.bitsItem) +
530+
" & " + String.format("%.3f", d.e) +
531+
" & " + Math.round(d.keysMillions) +
532+
" \\\\");
533+
}
534+
}
535+
502536
}

0 commit comments

Comments
 (0)