-
Notifications
You must be signed in to change notification settings - Fork 746
Description
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.