On Thu, Mar 5, 2020 at 11:03 AM Joshua Ashton joshua@froggi.es wrote:
This allocates these structs and arrays of structures on the stack instead of the heap (which is expensive and takes time!)
These structures and arrays of structures are small, and this is all super duper hot path code.
Would it make sense to keep the heap allocation as a slow-path if the assumption about the allocation size is wrong? For example, if count is less than 32 use alloca(), otherwise use the heap to avoid a stack overflow.