optimized serialization format

use custom serialization read/write routings to minimize
number of intermediate objects.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>