use compactRender in Serialization.write

should improve performance without any breaking api changes. thanks for the suggestion  @viktortnk