encoding: In BinaryXmlDecoder, cache the result of peekDTag for a speedup when decoding optional elements.
diff --git a/src/c/encoding/binary-xml-decoder.h b/src/c/encoding/binary-xml-decoder.h
index 38fd450..5072b97 100644
--- a/src/c/encoding/binary-xml-decoder.h
+++ b/src/c/encoding/binary-xml-decoder.h
@@ -19,6 +19,10 @@
uint8_t *input;
size_t inputLength;
size_t offset;
+ // peekDTag sets and checks these, and readElementStartDTag uses them to avoid reading again.
+ size_t previouslyPeekedDTagStartOffset;
+ size_t previouslyPeekedDTagEndOffset;
+ unsigned int previouslyPeekedDTag;
};
static inline void ndn_BinaryXmlDecoder_initialize(struct ndn_BinaryXmlDecoder *self, uint8_t *input, size_t inputLength)
@@ -26,6 +30,7 @@
self->input = input;
self->inputLength = inputLength;
self->offset = 0;
+ self->previouslyPeekedDTagStartOffset = (size_t)-1;
}
/**