diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2012-03-05 19:12:52 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2012-03-05 19:12:52 +0000 |
| commit | 2bd705facb5df85356918950d10a4125e2c177a0 (patch) | |
| tree | f86787b354ec7989100cad520290a080710fa1fe /qpid/cpp/include | |
| parent | 822e4b0752fbff6284129f8bd85e529fc92bb3fa (diff) | |
| download | qpid-python-2bd705facb5df85356918950d10a4125e2c177a0.tar.gz | |
QPID-3883: Using application headers in messages causes a very large slowdown
Lazily decode FieldTables, holding onto the actual raw bytes
until we really need to decode, if we encode the FieldTable before
decoding it we can just send the raw bytes we captured initially.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1297185 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
| -rw-r--r-- | qpid/cpp/include/qpid/framing/FieldTable.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/qpid/cpp/include/qpid/framing/FieldTable.h b/qpid/cpp/include/qpid/framing/FieldTable.h index ce0374d829..b404a06c9a 100644 --- a/qpid/cpp/include/qpid/framing/FieldTable.h +++ b/qpid/cpp/include/qpid/framing/FieldTable.h @@ -21,6 +21,7 @@ #include <iostream> #include <vector> #include <boost/shared_ptr.hpp> +#include <boost/shared_array.hpp> #include <map> #include "qpid/framing/amqp_types.h" #include "qpid/CommonImportExport.h" @@ -57,9 +58,7 @@ class FieldTable typedef ValueMap::value_type value_type; QPID_COMMON_EXTERN FieldTable(); - QPID_COMMON_EXTERN FieldTable(const FieldTable& ft); - QPID_COMMON_EXTERN ~FieldTable(); - QPID_COMMON_EXTERN FieldTable& operator=(const FieldTable& ft); + // Compiler default copy, assignment and destructor are fine QPID_COMMON_EXTERN uint32_t encodedSize() const; QPID_COMMON_EXTERN void encode(Buffer& buffer) const; QPID_COMMON_EXTERN void decode(Buffer& buffer); @@ -99,24 +98,24 @@ class FieldTable QPID_COMMON_EXTERN bool operator==(const FieldTable& other) const; // Map-like interface. - ValueMap::const_iterator begin() const { return values.begin(); } - ValueMap::const_iterator end() const { return values.end(); } - ValueMap::const_iterator find(const std::string& s) const { return values.find(s); } + ValueMap::const_iterator begin() const; + ValueMap::const_iterator end() const; + ValueMap::const_iterator find(const std::string& s) const; - ValueMap::iterator begin() { return values.begin(); } - ValueMap::iterator end() { return values.end(); } - ValueMap::iterator find(const std::string& s) { return values.find(s); } + ValueMap::iterator begin(); + ValueMap::iterator end(); + ValueMap::iterator find(const std::string& s); QPID_COMMON_EXTERN std::pair <ValueMap::iterator, bool> insert(const ValueMap::value_type&); QPID_COMMON_EXTERN ValueMap::iterator insert(ValueMap::iterator, const ValueMap::value_type&); void clear(); - // ### Hack Alert - - ValueMap::iterator getValues() { return values.begin(); } - private: - ValueMap values; + void realDecode() const; + void flushRawCache() const; + + mutable ValueMap values; + mutable boost::shared_array<uint8_t> cachedBytes; mutable uint32_t cachedSize; // if = 0 then non cached size as 0 is not a legal size QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream& out, const FieldTable& body); |
