Right now NullInt and NullBool get a byte slice from the underlying DB connection buffer, convert it to a string and then parse that string into an int/bool. The conversion from []byte to string requires a memory allocation, which we can avoid by parsing the int/bool directly from the []byte. atoi and parseBool are copied from Go's standard library and modified to work on byte slices instead of strings while preserving the existing behaviour (including errors etc.). Both methods are pretty simple and neither one has had any meaningful changes in the last few years, so I think the maintenance burden of copying them into our code base is pretty small.
Right now
NullInt
andNullBool
get a byte slice from the underlying DB connection buffer, convert it to a string and then parse that string into an int/bool. The conversion from[]byte
tostring
requires a memory allocation, which we can avoid by parsing the int/bool directly from the[]byte
.atoi
andparseBool
are copied from Go's standard library and modified to work on byte slices instead of strings while preserving the existing behaviour (including errors etc.). Both methods are pretty simple and neither one has had any meaningful changes in the last few years, so I think the maintenance burden of copying them into our code base is pretty small.