ClassicIO: Added deduction for call latency
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,8 @@ import java.io.IOException;
|
||||
*/
|
||||
public class ClassicIoBuffered {
|
||||
|
||||
public static int lineCount(String path){
|
||||
private static int lineCount(String path, boolean doDance){
|
||||
if ( ! doDance ) return -1;
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = new FileInputStream(path);
|
||||
@@ -41,9 +42,13 @@ public class ClassicIoBuffered {
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
long startTime = System.nanoTime();
|
||||
System.out.println("Lines: " + String.valueOf(lineCount("input.txt")));
|
||||
lineCount("", false);
|
||||
long dryRun = System.nanoTime() - startTime;
|
||||
startTime = System.nanoTime();
|
||||
int lines = lineCount("input.txt", true);
|
||||
long stopTime = System.nanoTime();
|
||||
System.out.println("Time it took: " + (stopTime - startTime));
|
||||
System.out.println("Lines: " + String.valueOf(lines));
|
||||
System.out.println("Time it took: " + (stopTime - startTime - dryRun) + " ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user