Replies: 3 comments 10 replies
-
That's certainly an option. basic_xxx_cursor could have a reset function as well. Perhaps with or without a new source, without if there are more documents in the original source. |
Beta Was this translation helpful? Give feedback.
-
@danielaparker, I've completed the unit tests for resettable parsers/cursors/encoders for JSON/CBOR/Msgpack, and they all pass, as well as all other existing unit tests. I'd like for you to review what I have now before proceeding with BSON, CSV, and UBJSON. I don't actually have a need for BSON/CSV/UBJSON, but I suppose you'll also want them to be resettable for the sake of completeness and uniformity. I can submit a PR for what I have now, and you can either merge it (after we make necessary changes), or we can just use it for discussion purposes until I submit a larger PR for all codecs. Please let me know how you'd like to proceed. |
Beta Was this translation helpful? Give feedback.
-
Completed in 8940235 for JSON/CBOR/Msgpack. |
Beta Was this translation helpful? Give feedback.
-
There is currently no way to reuse
basic_foo_encoder
instances after they've encoded a document. It would be nice to reuse the same encoder in a networking application to avoid a bunch of allocations and cache misses when there are many outbound messages to encode in a long-lived program.I suggest a
reset
method that takes a newSink
and resets all internal state so that it may encode a new document.Beta Was this translation helpful? Give feedback.
All reactions