Hello trumpetinc, On Apr 23, 2010, at 10:50 PM, trumpetinc wrote: > Don't know if it'll make any difference, but the way you are reading the file > is horribly inefficient. If the code you wrote is part of your test times, > you might want to re-try, but using this instead (I'm just tossing this > together - there might be type-os): > No, pre-loading the PDF template with the IO code I submitted was not part of the performance tests before. I added it quick and dirty just to try out and saw the massive performance improvement, I should have been skeptical but the Latin spirit took over :)
> ByteArrayOutputStream baos = new ByteArrayOutputStream(); > byte[] buf = new byte[8092]; > int n; > while ((n = is.read(buf)) >= 0) { > baos.write(buf, 0, n); > } > return baos.toByteArray(); > Thank you, I will try this one later ... >> From your results, are you seeing a big difference between iText and the > competitor when you aren't flattening fields vs you are flattening fields? > Your profiling results aren't indicating bottlenecks in that area of the > code. If iText is much faster than the competitor in the non-flattening > scenario, but slower than the competitor in the flattening scenario, I'm > having a hard time reconciling the data presented so far. > HEADER is a PDF file with no fields FOOTER is a PDF file with fields (needs to be populated and flattened i.e. stamper.setFormFlattening(true)) I prepared the equivalent exact same code for iText and the alternative. However, I did not measure the times for the two templates HEADER and FOOTER separately. So I can not tell if iText is faster loading with flat PDF than the alternative or if iText is faster loading the PDF with fields compared to the alternative. Just now I discovered that if the loaded PDF form does not have fields iText performs much faster. So I just modified my test-case to disable the HEADER and run and profile only FOOTER (the expensive one with fields) four times so that the top bottlenecks for this case will be better evidenced. Best regards, Giovanni ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/