Fix scan doing **<type>

Given that the reflect.New already returns a pointer to the type,
this additional Pointer caused the Scan to receive **<types>

The issue with this is that golang's database package contains optimizations
for single pointer types, and thus doesn't use reflection.

This patch (in my benchmarks) decreases CPU usage by 10% and memory usage
by 10%.
This commit is contained in:
Peter Turi 2024-02-03 12:45:23 +01:00
parent 418ee3fc19
commit 6f1960017c

View File

@ -985,6 +985,6 @@ func (field *Field) setupNewValuePool() {
}
if field.NewValuePool == nil {
field.NewValuePool = poolInitializer(reflect.PtrTo(field.IndirectFieldType))
field.NewValuePool = poolInitializer(field.IndirectFieldType)
}
}