diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-04-02 21:14:53 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-04-03 18:16:24 +0200 |
commit | 89f19b709916ed26d7499761140549a02c36d3f5 (patch) | |
tree | b08166a2b0da1fa704fe0c6c639e7fddd3a68de9 /include/qpdf | |
parent | 31092dc66bda7f1cb6c97daa89408a24919592d6 (diff) | |
download | qpdf-89f19b709916ed26d7499761140549a02c36d3f5.tar.zst |
Performance: remove Members indirection for QPDFObjectHandle
Diffstat (limited to 'include/qpdf')
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 9bf5f7f7..38f29106 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -251,10 +251,10 @@ class QPDFObjectHandle QPDF_DLL QPDFObjectHandle(); QPDF_DLL - QPDFObjectHandle(QPDFObjectHandle const&); + QPDFObjectHandle(QPDFObjectHandle const&) = default; QPDF_DLL QPDFObjectHandle& - operator=(QPDFObjectHandle const&); + operator=(QPDFObjectHandle const&) = default; QPDF_DLL bool isInitialized() const; @@ -957,7 +957,7 @@ class QPDFObjectHandle static PointerHolder<QPDFObject> getObject(QPDFObjectHandle& o) { o.dereference(); - return o.m->obj; + return o.obj; } }; friend class ObjAccessor; @@ -1077,29 +1077,16 @@ class QPDFObjectHandle std::string const& description, std::string& all_description); static void warn(QPDF*, QPDFExc const&); - class Members - { - friend class ObjAccessor; - friend class QPDFObjectHandle; - - public: - QPDF_DLL - ~Members(); + bool initialized; - private: - Members(); - Members(QPDF* qpdf, int objid, int generation); - Members(QPDFObject* data); - - bool initialized; - - QPDF* qpdf; - int objid; // 0 for direct object - int generation; - PointerHolder<QPDFObject> obj; - bool reserved; - }; - PointerHolder<Members> m; + // Moving members of QPDFObjectHandle into a smart pointer incurs + // a substantial performance penalty since QPDFObjectHandle + // objects are copied around so frequently. + QPDF* qpdf; + int objid; // 0 for direct object + int generation; + PointerHolder<QPDFObject> obj; + bool reserved; }; #endif // QPDFOBJECTHANDLE_HH |