Skip to content

Zero-copy JsonDocument and JsonElement reading #2818

@roji

Description

@roji

When reading JsonDocument and JsonElement, we currently first decode a string from our internal buffer, and parse that with JsonDocument.Parse() (see #2811). We could return a JsonDocument directly over the buffer (as a Memory), but would have to manage the buffer lifecycle - when we reread into the buffer, we would need to Dispose the JsonDocument instance we handed over to the user.

Not sure if CommandBehavior.SequentialAccess is enough of an explicit opt-in to this behavior - maybe it is.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions