◐ Shell
clean mode source ↗

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 / SetDbNull methods to CompositeFieldInfo for direct field setting
  • Split CompositeConverter.Read() into ReadDirect (fast path) and ReadWithBuilder (existing path)
  • Extract ValidateOid as a shared static method
  • Add test for nullable property through the fast path