Potentially expensive trimming of Chunk
bytes
#1571
Labels
Runtime Library
Issues related to the HILTI or Spicy runtime libraries
Chunk
bytes
#1571
A
Chunk
currently directly wraps containers holding its data. When callingChunk::trim
we directly trim these wrapped values,spicy/hilti/runtime/src/types/stream.cc
Line 56 in 4970368
spicy/hilti/runtime/src/types/stream.cc
Line 60 in 4970368
For the Zeek case we typically receive larger chunks and extract small bits from them, e.g., imagine a unit parsing a
uint8[]
. The current trim implementation makes sure that we free as much memory as possible (by removing each individual byte as soon as possible), but potentially incurs a performance overhead for that (e..g,std::vector::erase
requires touching all bytes in theChunk
). The current implementation shows pathological performance for e.g., inputs generated by oss-fuzz.We should consider using a cheaper implementation where
Chunk::trim
just moves the begin of aChunk
, but does not free the memory anymore.The text was updated successfully, but these errors were encountered: