> -----Original Message-----
> From: David Teran [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, April 12, 2002 0:32
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] optimizing formatDouble and append in
> ByteBuffer
> 
> Hi,
> 
> i played around with the profiling infos from the JVM and it turnes out 
> that formatDouble creates a lot of temporary byte[] and char[] and 
> String and StringBuffer's. I already implemented a simple cache and the 
> overall speed of a 23 page report is 10% better, memory usage without 
> garbage collection is 40% less. Is anyone else trying to optimize speed 
> and memory footprint of itext currently?
> 
        formatDouble already had an improvement but more sugestions are
welcomed.
        I thought of having a formatDouble(int) but most of the numbers are
float, anyway.

> The simple cache just caches all converted numbers from -32768 to 32768 
> and returns the cached bytes instead of recalculating them with 
> getISOBytes again.
> 
        Probably a cache from -100 to 1000 will cover 99.9% of the cases.
        getISOBytes can also be improved by casting the char directly to
byte.

> I will also implement a cache for ascii based String with a length <=2, 
> this should also increase performance and reduce memory usage because 
> getISOBytes shouldnt get called in this either.
> 
        Searching the cache also takes time. I don't know if getISOBytes
with direct cast wouldn't be as fast. Of course, there's a new byte[] that
must be accounted for. Only profiling will tell.

        Best Regards,
        Paulo Soares

> regards, david
> 
> 
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions

_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to