Skip to content

Commit

Permalink
preallocate vec for json serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonrnewhouse committed Nov 20, 2023
1 parent e79e9f9 commit c6a9d47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arroyo-worker/src/formats/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl<T: SchemaData> DataSerializer<T> {
pub fn to_vec(&self, record: &T) -> Option<Vec<u8>> {
match &self.format {
Format::Json(json) => {
let mut writer: Vec<u8> = vec![];
let mut writer: Vec<u8> = Vec::with_capacity(128);
if json.confluent_schema_registry {
writer.push(0);
writer.extend(json.confluent_schema_version.expect("must have computed schema version to write using confluent schema registry").to_be_bytes());
Expand Down

0 comments on commit c6a9d47

Please sign in to comment.