This adds a method serialize_cdata() that does exactly the same thing
as serialize(), except it returns a pointer to FFI array and length.
This is a workaround for degraded performance when the generated
messages have colliding hashes when interning with ffi.string.
The ffi.string generates a hash of the string by looking at the first
4B, middle 4B, and last 4B. When these are the same, it causes a hash
collision with an another string. This is unfortunately not something
that the caller is always able to affect, so the only workaround is
to not intern at all and use the char[] directly.
The generated function has the same function signature as serialize(),
except it has two returns values - pointer to the array, and the message length.
This adds a method serialize_cdata() that does exactly the same thing as serialize(), except it returns a pointer to FFI array and length. This is a workaround for degraded performance when the generated messages have colliding hashes when interning with ffi.string. The ffi.string generates a hash of the string by looking at the first 4B, middle 4B, and last 4B. When these are the same, it causes a hash collision with an another string. This is unfortunately not something that the caller is always able to affect, so the only workaround is to not intern at all and use the char[] directly.
The generated function has the same function signature as serialize(), except it has two returns values - pointer to the array, and the message length.