News for hackers. Stuff that matters.
Re:Go nulls and SQL by legorobot on Monday May 23, 2022 @03:34PM (#31483880)
I haven't thought about it that way! I've not hit the GC as a performance wall when it comes to accessing nullable DB values yet. Thanks for the insight.
Re:Go nulls and SQL by throwaway894345 on Monday May 23, 2022 @05:27PM (#31484965)
It's generally useful, not just in SQL. Any time you have a type that could be multiple things, you have to choose between a reference-based implementation (e.g., interfaces) or a tagged struct (a struct with a flag field that tells you what its runtime type). The tagged struct version is guaranteed not to allocate, while the interface version very likely will. Most of the time it will only matter if you're in a tight loop.