optimization in serialization layer

this patch removes redundancies and reduces string comparisons by
using session-dependent type IDs rather than sending type names