Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlignedBuffer: avoid unnecessary data copying when already aligned #32698

Closed
wants to merge 2 commits into from

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Jun 11, 2024

This update optimizes memory usage and execution time by avoiding unnecessary data copying when data is already aligned, which is typically the case. It improves the performance of handling Capnp messages, particularly in critical code blocks like can_send_thread(), can_capnp_to_can_list_cp(#32009), etc.

Cap'n Proto also performs the same alignment check internally. You can see an example of this in the following code snippet:

https://github.com/capnproto/capnproto/blob/f668fb59515d182ef3e6cefa7842662d4b37a8d7/c%2B%2B/src/capnp/compat/websocket-rpc.c%2B%2B#L49-L63

Copy link
Contributor

github-actions bot commented Jun 11, 2024

Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • the change is something we merge
    • include a route or your device' dongle ID if relevant

@deanlee deanlee force-pushed the cereal_improve_aligned_buffer branch from 21560cb to b597143 Compare June 11, 2024 07:49
@deanlee deanlee marked this pull request as draft June 11, 2024 08:04
@deanlee deanlee closed this Jun 11, 2024
@deanlee deanlee reopened this Jun 11, 2024
@deanlee deanlee force-pushed the cereal_improve_aligned_buffer branch 2 times, most recently from 284985c to dc1ae59 Compare June 11, 2024 09:05
@deanlee deanlee marked this pull request as ready for review June 11, 2024 10:29
Copy link
Contributor

This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity.

@github-actions github-actions bot added the stale label Jun 26, 2024
@deanlee deanlee force-pushed the cereal_improve_aligned_buffer branch from dc1ae59 to 82d7e2f Compare June 26, 2024 07:53
@github-actions github-actions bot removed the stale label Jun 27, 2024
Copy link
Contributor

This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity.

@github-actions github-actions bot added the stale label Jul 11, 2024
@deanlee deanlee force-pushed the cereal_improve_aligned_buffer branch from 82d7e2f to dcba7a3 Compare July 12, 2024 19:40
@github-actions github-actions bot removed the stale label Jul 13, 2024
Copy link
Contributor

This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity.

@github-actions github-actions bot added the stale label Jul 28, 2024
Copy link
Contributor

github-actions bot commented Aug 1, 2024

This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes.

@github-actions github-actions bot closed this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant