> > That said, mangos has an optimization where the header space is allocated > in such a way that attempts to avoid having to realloc or move a message > when we want to add additional header content. But I’m using go byte > slices for it. Sadly, go doesn’t have a nice way for me to preallocate > “headroom” like we do with NIC packet buffers in the kernel. > Go can create fixed-sized (unsafe even, I believe) arrays that you control deterministically, and then point your slices at them; you should have as precise control as you need. Dmitry discusses such tricks when he talks about how GoLeveldb works; http://go-talks.appspot.com/code.google.com/p/go-conc/trunk/slides/goruntime.slide#29