Bypass CompositeBuilder for parameterless composite types by yykkibbb · Pull Request #6458 · npgsql/npgsql
Fixes #6452
When ConstructorParameters == 0, CompositeBuilder is unnecessary — it just creates the instance, boxes it, and calls field.Set() for each field. This adds a fast path that skips the builder entirely, avoiding per-read allocations.
Changes
- Add
ReadAndSet/SetDbNullmethods toCompositeFieldInfofor direct field setting - Split
CompositeConverter.Read()intoReadDirect(fast path) andReadWithBuilder(existing path) - Extract
ValidateOidas a shared static method - Add test for nullable property through the fast path