AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
How to Allocate a Buffer of Size Eight
Go does something that's called escape analysis. We changed two lines of code and reduced it from 26 seconds to 600 milliseconds. The crazy thing is this one line needs no memory allocations. So if we do that again, our 1 billion numbers that took 26 seconds before now take 600 milliseconds. Now we're starting to get into a range where like this is acceptable for data for databases. And more importantly, the profile is so much simpler right now. There's basically just this one function there. But why we had to do that wasn't very intuitive. It would be cool if there was better education.