Avoid copy of data for UDP parsers
Closed this issue · 1 comments
Chatting with @rsmmr , one idea came up to prevent copying data for UDP/block analyzers:
spicy/spicy/runtime/src/driver.cc
Lines 259 to 281 in 26b3b79
If any iterators into the stream are invalidated after parse1
, seems the stream would not necessarily need to own the data.
This might improve performance for the spicy-quic analyzer when crunching through large transfers.
Relates to #1644
My takeaway from #1644 was that introducing a non-owning Chunk
introduces new overhead even in code not making use of it since it partially undos (the spirit of) the optimizations done in #1607, so we probably wouldn't want to use this approach here.
Since here the Stream
is always fully consumed we could instead introduce a non-owning Stream
for this problem. The naive zeroth implementation could just be a non-owning class derived from Stream
which stores a string_view
into the data; that would still incur the overhead of creating the base Stream
, but might already bring sufficient perf improvements.