Skip to content

Conversation

AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented Aug 5, 2025

Copy link

github-actions bot commented Aug 5, 2025

Test Results

  7 files  ±0    7 suites  ±0   5m 5s ⏱️ +10s
 54 tests ±0   53 ✅ ±0  1 💤 ±0  0 ❌ ±0 
223 runs  ±0  220 ✅ ±0  3 💤 ±0  0 ❌ ±0 

Results for commit 8909bbf. ± Comparison against base commit 8ffe89a.

♻️ This comment has been updated with latest results.

@AhmedSoliman AhmedSoliman marked this pull request as ready for review August 5, 2025 17:24

pub fn encode_as_bilrost<T: bilrost::Message>(value: &T) -> Bytes {
let buf = value.encode_fast();
let buf = value.encode_contiguous();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to ensure that into_vec() and Bytes::from() are zero-cost operations.

Copy link
Contributor

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me. Thank you so much. I only left one comment/question

Ok(())
}

fn estimate_json_serde_len<T: Serialize>(value: &T) -> Result<usize, serde_json::error::Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this make calculating the estimate_size as inefficient as actually serialising the type (plus the buf allocations).

In other words, how is that better than just serialising the value directly without knowing the size estimate before hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not really serializing, it's just performing all the visits needed to serialize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants