Profiling our Ruby event publishing pipeline, we see two big sources of unnecessary memory allocations:
- Avro::IO:DatumWriter#write_data allocates a hash of constant validation options
- Avro::SchemaValidator::Result allocates an errors array which is unnecessary for the common case of no validation errors
This is on a very hot codepath for us and accounts for roughly 30% of the memory allocated by this part of the event publishing pipeline.
Github PR coming shortly.