massive optimizations to packet sending, close #2128