zeek / spicy

C++ parser generator for dissecting protocols & files.
https://docs.zeek.org/projects/spicy
Other
246 stars 35 forks source link

Unroll ctrs of big containers. #1744

Closed bbannier closed 4 months ago

bbannier commented 4 months ago

When generating C++ code for container ctrs we previously would directly invoke the respective C++ ctrs taking an initializer list. For very big initializer lists this causes very bad C++ compiler performance, e.g., compiling code constructing a vector with 10,000 elements could take minutes.

With this patch we unroll such ctrs calls by calling a dedicated initialization function. For huge containers this causes creating of big functions instead of big initializer lists, but compiling functions seems to behave more predictively.

Closes #1742.