Skip to content

Optimize dns outgoing serialization#467

Open
anti-social wants to merge 4 commits intokeepsimple1:mainfrom
anti-social:optimize-dns-outgoing-serialization
Open

Optimize dns outgoing serialization#467
anti-social wants to merge 4 commits intokeepsimple1:mainfrom
anti-social:optimize-dns-outgoing-serialization

Conversation

@anti-social
Copy link
Copy Markdown
Contributor

No description provided.

@anti-social anti-social force-pushed the optimize-dns-outgoing-serialization branch from c50b724 to 9515df9 Compare April 27, 2026 16:21
@anti-social anti-social marked this pull request as ready for review April 27, 2026 16:38
@anti-social anti-social force-pushed the optimize-dns-outgoing-serialization branch from 5f7a5f3 to 6f978b3 Compare April 28, 2026 08:56
@anti-social anti-social force-pushed the optimize-dns-outgoing-serialization branch from 6f978b3 to 56659fe Compare April 28, 2026 08:57
Comment thread src/dns_parser.rs
Self {
data: Vec::new(),
size: MSG_HEADER_LEN, // Header is mandatory.
data: vec![0; MSG_HEADER_LEN],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Possibly we could create a vector with capacity of 32 bytes to reduce future reallocations.

Comment thread src/dns_parser.rs

pub fn to_bytes(&self) -> Vec<u8> {
self.data.concat()
pub fn as_bytes(&self) -> &[u8] {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we need backward compatibility I will add to_bytes(&self) -> Vec<u8> method

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.

1 participant