btw, why do these need to get changed to ints?
and, do you notice with task manager that
CPU is not at 100 pct? This often indicates
disk limit- either explicit IO or VM.
 
I've actually had c++ code that I thought
was computationally limited turn out to 
be IO limited. Often simple compression is
well worth the effort. Not just for explicit
disk transfer rates, but for saving memory
to keep more things in low level cache
or out of VM. 

And, again, more generally prefer things
with "[]" in sig, including string ops if
you even need strings instead of [].



----------------------------------------
> Date: Fri, 23 Apr 2010 13:50:49 -0700
> From: forum_...@trumpetinc.com
> To: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] AW ESOME! performance follow up
>
>
> 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):
>
> 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();
>
>
> If loading the file into main memory makes any difference, that difference
> will be a measure of the impact of virtual<->native interface interaction.
> In effect, this is telling us whether the calls to file.read() should be
> replaced with file.read(byte[]).
>
>
>
>>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.
>
>
>
> Giovanni Azua-2 wrote:
>>
>>
>> I am sooo sorry the performance is worse with the change for pre-loading
>> the PDFs in the test-case :(((((( the problem was that I ran the
>> benchmarks with a small mistake in my test case ...
>>
>> Loading the HEADER demonstrates how to load flattened pre-formatted PDF
>> part templates ...
>>
>> Loading the FOOTER demonstrates how to load PDF part templates containing
>> fields that need to be populated.
>>
>> The mistake was to leave fixed the HEADER always ... so it would load only
>> the flattened PDF template and not the footer (see below) [sigh] In any
>> case is good to know that loading flattened PDF parts is cheaper.
>>
>> I mistakenly ran the last benchmark like this:
>>
>> private static byte[] file2ByteArray(String filePath) throws Exception {
>> InputStream input = null;
>> ByteArrayOutputStream output = null;
>> try {
>> input = new BufferedInputStream(new FileInputStream(HEADER_PATH));
>> output = new ByteArrayOutputStream();
>> int data = input.read();
>> while (data != -1) {
>> output.write(data);
>>
>> data = input.read();
>> }
>>
>> return output.toByteArray();
>> }
>> finally {
>> if (input != null) {
>> input.close();
>> }
>>
>> if (output != null) {
>> output.close();
>> }
>> }
>> }
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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/
>>
>
> --
> View this message in context: 
> http://old.nabble.com/performance-follow-up-tp28322800p28346146.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> 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/  
>                                   
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
------------------------------------------------------------------------------
_______________________________________________
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/

Reply via email to