DataStreamPeer: Optimize IrcUsersAndChannels init data
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 15 Feb 2014 20:40:45 +0000 (21:40 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 15 Feb 2014 21:01:02 +0000 (22:01 +0100)
commit208ccb6d91ebb3c26a67c35c11411ba3ab27708a
tree11cb15689e590792cc582adba17c150206b791c2
parentd1d1e6ef1d2073d629bf54fd8e0d31f647f9cb88
DataStreamPeer: Optimize IrcUsersAndChannels init data

This is the only occasion where we change the actual message contents
for the DataStream protocol, as opposed to the legacy protocol.

However, it's worth it, because the init data for IrcUsers is the single
biggest offender in terms of data usage during sync, and we were wasting
lots of space by sending potentially thousands of identically-structured
QVariantMaps (one per IrcUser), each of which contains an indentical set
of key names. The same was true for IrcChannels in that same message,
although the data set tends to be smaller for that one.

We've now changed that by sending the init data for all the users and
channels as lists of attributes, which are then reassembled into individual
initData maps after receiving them. Our benchmarks show space savings
around 56%, which can amount to several megabytes in the uncompressed case,
provided you are in lots of busy channels. With compression it's less
impressive, but we can still save a few hundred kilobytes.

The legacy protocol gains a pair of translation methods for this special case,
thus there are no changes in the legacy format.
src/common/network.cpp
src/common/protocols/legacy/legacypeer.cpp
src/common/protocols/legacy/legacypeer.h