Greetings,

I want to make available patches I've made to version 2.1.7 in order to be
more memory and cpu efficient (due to avoiding the creation of unnecessary
objects). We're not ready to make the jump to 5.x and so we're staying with
2.1.7 for the forseeable future. I haven't looked at the 5.x source but
maybe some of these changes can be ported.

This patch:
1. Caches and reuses lots of the objects created when reading in PDF files:
PdfString, PdfNumber, and PdfName.
2. Removes the PdfNumber mutator method increment().
3. Interns strings that are tokens in font files
4. Provides initial capacities for the HashMaps used to store font
information.

I've taken the liberty of removing the increment() method from PdfNumber
because these objects should not be modified if we are caching them and I
didn't find any uses of the method. You're free to keep the method and not
cache PdfNumber as you see fit.

One area that may need closer review is the caching of PdfString objects
when the two ints objNum and objGen are passed in. Apparently they're used
for encryption but I didn't grok the code. Currently those ints are ignored
when caching PdfString values. If it's necessary to cache PdfString objects
based on them, either add them as part of the key or don't cache them. See
getPdfString() in PdfReader. Also, I kept the HashMaps in the PdfReader
class for my convenience. If I were maintaining this code longer term, I
might think about relocating them.

Many thanks to everyone for a great PDF library, especially to Bruno and
Paulo. Feedback encouraged.

Thanks,
Barry

Attachment: itext-2.1.7.patch
Description: Binary data

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to