Buffer all IO to reduce the overhead on Go system calls. On a system call, current Goroutines yield to that call.
When possible in tight loops, use structs instead of interfaces to minimize the interface methods indirection overhead.
Use pre-allocated buffers within tight loops (similarly to how io.Reader works) to minimize garbage collection pressure.
Process data rows in batches as a workaround to poor compiler inlining, as to move the actual computation closer to the data and minimize the overhead on each function call. …