On Wed, 2017-01-11 at 12:34 +0000, Mark Rogers wrote:
> Is this worth doing? Can you think of any problems this might cause?

        Hi,
that's a very good idea to have such cache for repeated names.

The only thing is that I would be afraid of the lifetime of the
PdfName. Imagine that the caller creates a copy of the whole
dictionary. Will the PdfName-s in it be valid all the time, or only
until the original PdfDictionary, or its document, is cleared? Some
such issues. I believe there can be found more like this.

A simpler (not from the coding side) would be to not cache whole
PdfName object, but only the string associated with it, on
a ref-counted base. That is, the PdfName would have its own string
cache, from which it would borrow the string and reference it by one,
then dereference it in its destructor. Such string cache can be fully
hidden from the caller and the best it would take care of itself
transparently, without a need to any management, like when and where to
free it, thus it would not grow ad infinity.

What do you think?

        Bye,
        zyx

-- 
http://www.litePDF.cz                                 i...@litepdf.cz

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to