A fast and easy way to handle this is to use a fixed lines-size block buffer.
This way compression/decompression is clustered in a way that it is only needed when blocksize is reached to both reads and writes.
pseudo code:
create a vector writeBuffer
and when writeBuffer.size() == blocksize compress the writeBuffer and store it in vector< buffer* > mBlocks
Less resources would required if we compress messages using for example Google snappy https://code.google.com/p/snappy/
A fast and easy way to handle this is to use a fixed lines-size block buffer. This way compression/decompression is clustered in a way that it is only needed when blocksize is reached to both reads and writes.
pseudo code: create a vector writeBuffer
and when writeBuffer.size() == blocksize compress the writeBuffer and store it in vector< buffer* > mBlocks
see https://code.google.com/p/buggazer/source/browse/source/BugGazer/Storage/SnappyBlocks.cs
specifically, the method string GetText(int stringId)