RED-6126: performance-test
*fixed time calculation
This commit is contained in:
parent
8db0b712f7
commit
7028baaaf5
@ -72,7 +72,7 @@ public class OCRService {
|
|||||||
invisibleElementRemovalService.removeInvisibleElements(fileStream, transferOutputStream, false);
|
invisibleElementRemovalService.removeInvisibleElements(fileStream, transferOutputStream, false);
|
||||||
}
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
log.info("Invisible element removal successful for file with dossierId {} and fileId {}, took {}s", dossierId, fileId, format("%.1f", (float) ((end - start) / 1000)));
|
log.info("Invisible element removal successful for file with dossierId {} and fileId {}, took {}s", dossierId, fileId, format("%.1f", (end - start) / 1000.0));
|
||||||
try (InputStream transferInputStream = new ByteArrayInputStream(transferOutputStream.toByteArray())) {
|
try (InputStream transferInputStream = new ByteArrayInputStream(transferOutputStream.toByteArray())) {
|
||||||
runOcr(transferInputStream, out, fileId);
|
runOcr(transferInputStream, out, fileId);
|
||||||
}
|
}
|
||||||
@ -93,12 +93,12 @@ public class OCRService {
|
|||||||
Map<Integer, RectCollection> pageIdToRectCollection = imagePositionRetrievalService.getImagePositionPerPage(pdfDoc, true);
|
Map<Integer, RectCollection> pageIdToRectCollection = imagePositionRetrievalService.getImagePositionPerPage(pdfDoc, true);
|
||||||
|
|
||||||
int numProcessedPages = 0;
|
int numProcessedPages = 0;
|
||||||
|
// optimization: only scanning pages that contain images
|
||||||
for (Integer pageId : pageIdToRectCollection.keySet()) {
|
for (Integer pageId : pageIdToRectCollection.keySet()) {
|
||||||
try {
|
try {
|
||||||
// optimization: creating a new document is faster than reusing the same and adding/removing pages one by one
|
// optimization: creating a new document is faster than reusing the same and adding/removing pages one by one
|
||||||
OCROptions options = new OCROptions();
|
OCROptions options = new OCROptions();
|
||||||
PDFDoc ocrPageDoc = new PDFDoc();
|
PDFDoc ocrPageDoc = new PDFDoc();
|
||||||
// optimization: only scanning pages that contain images
|
|
||||||
Page pdfPage = pdfDoc.getPage(pageId);
|
Page pdfPage = pdfDoc.getPage(pageId);
|
||||||
// optimization: this line ensures the ocr text is placed correctly by PDFTron
|
// optimization: this line ensures the ocr text is placed correctly by PDFTron
|
||||||
pdfPage.setMediaBox(pdfPage.getCropBox());
|
pdfPage.setMediaBox(pdfPage.getCropBox());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user