2
0

Cache connection properties in the pool

This is a quick attempt to improve connection startup time by caching
the properties that are loaded when a connection is ready in the pool,
so that further connections don't incur this cost.

I'm not entirely convinced by the interface here, perhaps these 3 items
could live in their own type and that be passed around for clearer code,
but the idea works well.
This commit is contained in:
John Barker
2016-05-10 18:34:26 -04:00
parent d9fb1351fb
commit a282d9df90
3 changed files with 31 additions and 13 deletions
+2 -2
View File
@@ -1576,10 +1576,10 @@ func encodeIPNet(w *WriteBuf, oid Oid, value net.IPNet) error {
switch len(value.IP) {
case net.IPv4len:
size = 8
family = w.conn.pgsql_af_inet
family = *w.conn.pgsql_af_inet
case net.IPv6len:
size = 20
family = w.conn.pgsql_af_inet6
family = *w.conn.pgsql_af_inet6
default:
return fmt.Errorf("Unexpected IP length: %v", len(value.IP))
}