Skip to content

Commit

Permalink
Add timing for benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmorris committed Apr 15, 2016
1 parent 9c4f5ea commit de61379
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public static void processHtmlFile(File input, File outFile, boolean keepMinimal
Charset charset = CHARSET_DETECTOR.detectCharset(bytes);
String html = new String(bytes, charset);

long startTime = System.currentTimeMillis();

// boilerplate removal
String cleanText;
if (keepMinimalHtml) {
Expand All @@ -72,6 +74,8 @@ public static void processHtmlFile(File input, File outFile, boolean keepMinimal
cleanText = boilerPlateRemoval.getPlainText(html, null);
}

System.out.printf("Processed %d bytes in %02f seconds%n", bytes.length,
(System.currentTimeMillis() - startTime) / 1000.0);
// write to the output file
PrintWriter writer = new PrintWriter(outFile, "utf-8");
writer.write(cleanText);
Expand Down

0 comments on commit de61379

Please sign in to comment.