You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2019/04/12 22:21:50 UTC
[tika] branch TIKA-2849 updated: TIKA-2849 -- small update to
timing test
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch TIKA-2849
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/TIKA-2849 by this push:
new d5c8e85 TIKA-2849 -- small update to timing test
d5c8e85 is described below
commit d5c8e853e736d1c8faba6c1753ea7875935980e8
Author: TALLISON <ta...@apache.org>
AuthorDate: Fri Apr 12 18:21:39 2019 -0400
TIKA-2849 -- small update to timing test
---
.../tika/parser/pkg/ZipContainerDetectorTest.java | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/tika-parsers/src/test/java/org/apache/tika/parser/pkg/ZipContainerDetectorTest.java b/tika-parsers/src/test/java/org/apache/tika/parser/pkg/ZipContainerDetectorTest.java
index bcba573..d18e638 100644
--- a/tika-parsers/src/test/java/org/apache/tika/parser/pkg/ZipContainerDetectorTest.java
+++ b/tika-parsers/src/test/java/org/apache/tika/parser/pkg/ZipContainerDetectorTest.java
@@ -111,7 +111,6 @@ public class ZipContainerDetectorTest extends TikaTest {
}
@Test
- @Ignore("to be used for offline timing tests")
public void timeDetection() throws Exception {
TikaConfig config = TikaConfig.getDefaultConfig();
Detector detector = config.getDetector();
@@ -119,16 +118,26 @@ public class ZipContainerDetectorTest extends TikaTest {
List<File> zips = getTestZipBasedFiles(detector, registry);
Set<MediaType> mediaTypeSet = new HashSet<>();
- long stream = 0;
- long file = 0;
- for (int i = 0; i < 20; i++) {
+ long nonTikaStream = 0;
+ long tikaStream = 0;
+ long tikaStreamWFile = 0;
+ for (int i = 0; i < 10; i++) {
for (File z : zips) {
long start = System.currentTimeMillis();
try (InputStream is = new BufferedInputStream(new FileInputStream(z))) {
MediaType mt = detector.detect(is, new Metadata());
mediaTypeSet.add(mt);
}
- stream += System.currentTimeMillis()-start;
+ nonTikaStream += System.currentTimeMillis()-start;
+ }
+ for (File z : zips) {
+ long start = System.currentTimeMillis();
+ try (InputStream is = TikaInputStream.get(
+ new BufferedInputStream(new FileInputStream(z)))) {
+ MediaType mt = detector.detect(is, new Metadata());
+ mediaTypeSet.add(mt);
+ }
+ tikaStream += System.currentTimeMillis()-start;
}
for (File z : zips) {
@@ -137,10 +146,10 @@ public class ZipContainerDetectorTest extends TikaTest {
MediaType mt = detector.detect(is, new Metadata());
mediaTypeSet.add(mt);
}
- file += System.currentTimeMillis()-start;
+ tikaStreamWFile += System.currentTimeMillis()-start;
}
}
- System.out.println("stream: "+stream + " file: "+file);
+ System.out.println("tika stream: "+tikaStream + " tika stream w file: "+tikaStreamWFile + " non tika stream:"+nonTikaStream);
}
@Test