Skip to content

Implement a streaming API, and read input lazily #15

Open
@richkadel

Description

@richkadel

Depending on the formatter configuration, some nested levels will not be streamable, but for any layer that does not reorder its elements, that layer can be streamed.

In particular, the top level ParsedDocument is represented as an outermost Array, most commonly consisting of Object-typed elements, which are typically not reordered.

In a fairly common scenario, some very large documents are large because they contain 100s or 1000s of top-level objects, but any individual object is more than likely of a much more manageable size. With streaming, we should be able to format each object as its parsed, which will be much better for large documents than the current implementation that requires reading the entire document into memory before formatting.

Only read from the input to the parser as needed (lazily) as the formatter completes formatting the previously streamed content. (This is sometimes referred to as "backpressure" provided by the formatter, to limit the flow of input from the parser.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions