add second parser that uses a standard CSV reader

This commit is contained in:
2021-08-12 17:54:27 +02:00
parent 825bac24b9
commit 67c66ef89d
18 changed files with 584 additions and 221 deletions

View File

@@ -185,11 +185,14 @@ public class DiskStorage implements AutoCloseable {
}
private Optional<FreeListNode> findFreeBlockWithSize(final long blockSize) throws IOException {
final long start = System.nanoTime();
FreeListNode result = null;
final long freeListRootNodePosition = readFreeListRootNodePosition();
int counter = 0;
long nextFreeListNodeOffset = freeListRootNodePosition;
while (nextFreeListNodeOffset > 0) {
counter++;
final var freeListNode = readFreeListNode(nextFreeListNodeOffset);
if (freeListNode.getSize() == blockSize) {
@@ -198,6 +201,10 @@ public class DiskStorage implements AutoCloseable {
}
nextFreeListNodeOffset = freeListNode.getNext();
}
final double d = (System.nanoTime() - start) / 1_000_000.0;
if (d > 0.5) {
System.out.println("findFreeBlockWithSize took: " + d + " ms counter" + counter);
}
return Optional.ofNullable(result);
}