Skip to content

Conversation

@ties
Copy link
Contributor

@ties ties commented Feb 8, 2026

Use zerocopy for parsing the MRT header. This potentially saves a number of read syscalls. Personally I also think the pattern is quite readable for parsing structs from the wire.

@ties ties force-pushed the feature/mrt_header_parsing branch from 6292647 to 6ee084c Compare February 8, 2026 21:23
@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.09%. Comparing base (5eb9107) to head (96a948f).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #263      +/-   ##
==========================================
- Coverage   91.23%   91.09%   -0.14%     
==========================================
  Files          83       83              
  Lines       14939    14974      +35     
==========================================
+ Hits        13630    13641      +11     
- Misses       1309     1333      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates MRT common-header parsing/encoding to use zerocopy for struct-based, big-endian field access, aiming to reduce per-field cursor reads and simplify on-wire layout handling.

Changes:

  • Introduce RawMrtCommonHeader / RawMrtEtCommonHeader on-wire structs and parse via zerocopy.
  • Update CommonHeader::encode() to serialize via the same raw header structs.
  • Add Criterion benchmarks for into_raw_record_iter on updates and RIB inputs; add optional zerocopy dependency behind the parser feature.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/parser/mrt/mrt_header.rs Switch MRT header parsing/encoding to zerocopy-backed raw structs; adjust ET handling to build combined header bytes without BytesMut.
benches/internals.rs Add benchmark cases for into_raw_record_iter on updates and RIB datasets.
Cargo.toml Add optional zerocopy dependency and include it in the parser feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +18 to +19
const _: () = assert!(size_of::<RawMrtCommonHeader>() == 12);

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

size_of is used in the const assertions but isn’t imported or fully qualified, which will fail to compile. Import core::mem::size_of/std::mem::size_of (or change these calls to core::mem::size_of::<...>()).

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@digizeph digizeph force-pushed the feature/mrt_header_parsing branch from 90f7029 to 96a948f Compare February 9, 2026 22:04
@digizeph digizeph merged commit a420e5a into bgpkit:main Feb 9, 2026
6 checks passed
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