I have noticed that you are using Couchbase.Utils.MemoryReaderStream for ReadOnlyMemory. But instead of it, you can use an optimized stream from Microsoft. There is low-level work with memory.
Thanks for pointing this out. I wasn’t aware of it. I looked into it briefly, but I’m not sure if it really offers much performance advantage for our use case. We haven’t bothered to implement the asynchronous overloads because they’re not used by the synchronous JSON deserialization we’re calling. And the synchronous implementation is pretty much the same.
There may be some small tricks in there that help, but I’d probably be more interested in porting those tricks to our implementation rather than adding another dependency. Our general approach is to keep the dependency tree as small as possible to prevent versioning conflicts with our consumers.