add second parser that uses a standard CSV reader
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user