Skip to content

perf(hesai): get rid of copy when replaying /pandar_packets#379

Open
mojomex wants to merge 3 commits intomainfrom
perf/reduce-hesai-copies
Open

perf(hesai): get rid of copy when replaying /pandar_packets#379
mojomex wants to merge 3 commits intomainfrom
perf/reduce-hesai-copies

Conversation

@mojomex
Copy link
Collaborator

@mojomex mojomex commented Nov 27, 2025

PR Type

  • Improvement

Related Links

Description

This PR removes an unnecessary per-packet copy when replaying /pandar_packets. Due to the conversion between PandarScan and NebulaPackets, a copy of the buffer (std::array vs. std::vector) was necessary before.

Now, we reference the incoming buffer via gsl::span, no matter if std::vector from UDP or std::array from PandarScan.

Outgoing packets are still copied.

Review Procedure

  • code review
  • test record/replay functionality
  • confirm memory safety

Remarks

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp>
@mojomex
Copy link
Collaborator Author

mojomex commented Nov 27, 2025

🟢 Self-Evaluation

Tests performed:

Status Test Comment
🟢 Connect to Pandar128E4X, record packets worked as intended
🟢 Replay recorded packets worked as intended
🟢 Compile and run with AddressSanitizer needs ASAN_OPTIONS=new_delete_type_mismatch=0 but passes. The errors are occuring in middleware code and are unrelated AFAIK. This was already the case before this PR.

@mojomex mojomex requested a review from veqcc November 27, 2025 08:50
@mojomex mojomex self-assigned this Nov 27, 2025
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 21.42857% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.35%. Comparing base (8781a6b) to head (58f7d5f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
- Coverage   34.36%   32.35%   -2.02%     
==========================================
  Files         130      131       +1     
  Lines       10519    10506      -13     
  Branches     5708     4808     -900     
==========================================
- Hits         3615     3399     -216     
- Misses       6188     6487     +299     
+ Partials      716      620      -96     
Flag Coverage Δ
differential 32.35% <21.42%> (?)
total ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Common 35.10% <ø> (-17.64%) ⬇️
Hesai 34.30% <21.42%> (+0.11%) ⬆️
Velodyne 39.58% <ø> (+0.01%) ⬆️
Continental 32.03% <ø> (+0.01%) ⬆️
Robosense 5.39% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp>
Signed-off-by: Max SCHMELLER <max.schmeller@tier4.jp>
@mojomex mojomex requested a review from veqcc November 27, 2025 09:19
@mojomex mojomex requested a review from drwnz November 27, 2025 10:02
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