Buffer the slip packet before sending.
Buffer the slip packet before sending.

On Mac OS X, sending the slip packet byte by byte results in an abysmal
performance. The first byte takes up to 160ms to send, and each next
byte approximately 250ms. The packet to request a data block is
typically 7 bytes large, and therefore takes about 1660ms to send.
Because a dive is transmitted as multiple smaller packets (typically
144 bytes without protocol overhead), downloading a single dive can
easily take several seconds.

However, when sending the entire slip packet at once, the time remains
roughly identical to sending just the first byte. The result is that
the time for sending a packet reduces significantly, proportional to
the length of the packet.

Under the hood, the slip packet is now internally buffered, and the
buffer is send only when the entire packet is complete, or whenever the
buffer gets full. But in practice, the buffer is large enough to always
store an entire packet.

In the original bug report, downloading 57 dives took about 40 minutes.
After applying the patch, that time reduced to only 5 minutes!

henrik242/libdivecomputer,glance-/libdivecomputer,henrik242/libdivecomputer,josh-wambua/libdivecomputer,venkateshshukla/libdivecomputer,Poltsi/libdivecomputer-vms,josh-wambua/libdivecomputer,glance-/libdivecomputer,venkateshshukla/libdivecomputer