diff --git a/src/value/ser.rs b/src/value/ser.rs index a68193437..1ffe7b7f1 100644 --- a/src/value/ser.rs +++ b/src/value/ser.rs @@ -261,9 +261,9 @@ impl serde::Serializer for Serializer { }) } - fn serialize_map(self, _len: Option) -> Result { + fn serialize_map(self, len: Option) -> Result { Ok(SerializeMap::Map { - map: Map::new(), + map: Map::with_capacity(len.unwrap_or(0)), next_key: None, }) }