Skip to content

Lazily parse TLS vector contents to eliminate intermedaite Vec construction #907

@briansmith

Description

@briansmith

When we parse a TLS handshake message, we eagerly parse the contents of each TLS vector, constructing a Vec<_> containing the parsed and validated contents, using code equivalent to this:

    let a = vector_contents.iter().try_map(T::decode).collect<Vec<_>>?;

My suggestion is that we avoid the collect step in as many cases as practical so that we instead operate on the iterators that lazily do the parsing/conversion as each entry is looked at. This should become practical to do if we implement #906.

This would divorce the order in which we validate the contents of the vectors from the order they appear in the structures.

This would also reduce the amount of validation we do, limiting it to the contents of the vectors we actually look at. IMO this is a good thing because it's good for performance, though it's different than what we do today. This works especially well if we avoid trying to detect duplicates in the vectors.

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