[PR #1388] [MERGED] Optimize name parsing #2285

Closed
opened 2026-03-16 08:45:22 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1388
Author: @saethlin
Created: 2/24/2021
Status: Merged
Merged: 3/8/2021
Merged by: @bluejekyll

Base: mainHead: optimize-name-parsing


📝 Commits (4)

  • 116a4a8 Add a non-artificial Message parsing benchmark
  • 7b6b79a Optimize Name parsing by using a pair of TinyVec
  • 31cba74 Cleanliness feedback from @djc
  • d5d3db5 Remove duplicate initialization of is_fqdn

📊 Changes

8 files changed (+180 additions, -111 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/client/src/rr/lower_name.rs (+1 -10)
📝 crates/proto/Cargo.toml (+1 -0)
📝 crates/proto/benches/lib.rs (+21 -0)
📝 crates/proto/src/rr/domain/label.rs (+6 -6)
📝 crates/proto/src/rr/domain/name.rs (+148 -95)
📝 crates/resolver/src/error.rs (+1 -0)
📝 crates/server/src/authority/error.rs (+1 -0)

📄 Description

This is deliberately a draft. Looking to investigate an approach like flatvec too, but my instinct is that this approach is better (at the expense of making Name larger) because it avoid allocations entirely for a lot of common domain names; 4 labels or less all 16 bytes or less. We're going with the flatvec-style approach to make better use of the expanded stack footprint.

Before:

test bench_parse_real_message          ... bench:       4,219 ns/iter (+/- 38)

After:

test bench_parse_real_message          ... bench:       1,780 ns/iter (+/- 16)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1388 **Author:** [@saethlin](https://github.com/saethlin) **Created:** 2/24/2021 **Status:** ✅ Merged **Merged:** 3/8/2021 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `optimize-name-parsing` --- ### 📝 Commits (4) - [`116a4a8`](https://github.com/hickory-dns/hickory-dns/commit/116a4a8bcc018242a92a9c7abd55501cefecc0ec) Add a non-artificial Message parsing benchmark - [`7b6b79a`](https://github.com/hickory-dns/hickory-dns/commit/7b6b79a960aaf573967daa9ddde62197400d9615) Optimize Name parsing by using a pair of TinyVec - [`31cba74`](https://github.com/hickory-dns/hickory-dns/commit/31cba74573dea282f7b673a873841eca4b0e2c01) Cleanliness feedback from @djc - [`d5d3db5`](https://github.com/hickory-dns/hickory-dns/commit/d5d3db571a9fdade28c8c154ea59999a3412b62a) Remove duplicate initialization of is_fqdn ### 📊 Changes **8 files changed** (+180 additions, -111 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/client/src/rr/lower_name.rs` (+1 -10) 📝 `crates/proto/Cargo.toml` (+1 -0) 📝 `crates/proto/benches/lib.rs` (+21 -0) 📝 `crates/proto/src/rr/domain/label.rs` (+6 -6) 📝 `crates/proto/src/rr/domain/name.rs` (+148 -95) 📝 `crates/resolver/src/error.rs` (+1 -0) 📝 `crates/server/src/authority/error.rs` (+1 -0) </details> ### 📄 Description ~This is deliberately a draft. Looking to investigate an approach like [flatvec](https://crates.io/crates/flatvec) too, but my instinct is that this approach is better (at the expense of making `Name` larger) because it avoid allocations entirely for a lot of common domain names; 4 labels or less all 16 bytes or less.~ We're going with the flatvec-style approach to make better use of the expanded stack footprint. Before: ``` test bench_parse_real_message ... bench: 4,219 ns/iter (+/- 38) ``` After: ``` test bench_parse_real_message ... bench: 1,780 ns/iter (+/- 16) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 08:45:22 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2285
No description provided.