Skip to content

[codegen] Test and document codegen for SplitAt and Split#3111

Open
jswrenn wants to merge 1 commit intoG597bda54d270c35d807e04218fc99b8deec41473from
G09ea59a47925616837b859b2c3cdf7f0f919232e
Open

[codegen] Test and document codegen for SplitAt and Split#3111
jswrenn wants to merge 1 commit intoG597bda54d270c35d807e04218fc99b8deec41473from
G09ea59a47925616837b859b2c3cdf7f0f919232e

Conversation

@jswrenn
Copy link
Collaborator

@jswrenn jswrenn commented Mar 13, 2026


Latest Update: v9 — Compare vs v8

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v8 v7 v6 v5 v4 v3 v2 v1 Base
v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v8 v7 v6 v5 v4 v3 v2 v1 Base
v7 v6 v5 v4 v3 v2 v1 Base
v6 v5 v4 v3 v2 v1 Base
v5 v4 v3 v2 v1 Base
v4 v3 v2 v1 Base
v3 v2 v1 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/G09ea59a47925616837b859b2c3cdf7f0f919232e && git checkout -b pr-G09ea59a47925616837b859b2c3cdf7f0f919232e FETCH_HEAD

Checkout

git fetch origin refs/heads/G09ea59a47925616837b859b2c3cdf7f0f919232e && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/G09ea59a47925616837b859b2c3cdf7f0f919232e && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/G09ea59a47925616837b859b2c3cdf7f0f919232e

Stacked PRs enabled by GHerrit.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the testing and documentation of the SplitAt and Split traits within the codegen system. It introduces a suite of new benchmarks to rigorously evaluate the performance and correctness of various splitting operations on different data structures. The documentation has been updated to directly reference these benchmarks, providing a transparent view of the generated code and its efficiency. This ensures that the SplitAt and Split functionalities are well-tested and clearly understood.

Highlights

  • New Benchmarks for SplitAt and Split: Introduced a comprehensive suite of new benchmarks for various SplitAt and Split methods, including split_at, split_at_unchecked, via_immutable, via_runtime_check, and via_unchecked. These benchmarks cover both dynamically sized and dynamically padded types to thoroughly test code generation.
  • Codegen Documentation Integration: Integrated codegen_section! and codegen_header! macros into the documentation of SplitAt and Split methods. This links directly to the newly added benchmarks, providing clearer insights into the generated code and performance characteristics.
  • Benchmark Infrastructure Expansion: Expanded the benchmark infrastructure by adding corresponding x86-64 assembly and machine code analysis (MCA) outputs for all new benchmarks, allowing for detailed performance evaluation.
  • Derive Macro Updates: Updated Packet structs in benchmark formats (coco_dynamic_padding.rs and coco_dynamic_size.rs) to derive the SplitAt trait, enabling the new splitting functionalities for these test structures.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • benches/formats/coco_dynamic_padding.rs
    • Enabled SplitAt derive for the Packet struct.
  • benches/formats/coco_dynamic_size.rs
    • Enabled SplitAt derive for structs generated by the define_packet! macro.
  • benches/split_at_dynamic_padding.rs
    • Added a new benchmark for the split_at method on dynamically padded types.
  • benches/split_at_dynamic_padding.x86-64
    • Added x86-64 assembly output for the split_at benchmark with dynamic padding.
  • benches/split_at_dynamic_padding.x86-64.mca
    • Added machine code analysis (MCA) output for the split_at benchmark with dynamic padding.
  • benches/split_at_dynamic_size.rs
    • Added a new benchmark for the split_at method on dynamically sized types.
  • benches/split_at_dynamic_size.x86-64
    • Added x86-64 assembly output for the split_at benchmark with dynamic sizing.
  • benches/split_at_dynamic_size.x86-64.mca
    • Added machine code analysis (MCA) output for the split_at benchmark with dynamic sizing.
  • benches/split_at_unchecked_dynamic_padding.rs
    • Added a new benchmark for the split_at_unchecked method on dynamically padded types.
  • benches/split_at_unchecked_dynamic_padding.x86-64
    • Added x86-64 assembly output for the split_at_unchecked benchmark with dynamic padding.
  • benches/split_at_unchecked_dynamic_padding.x86-64.mca
    • Added machine code analysis (MCA) output for the split_at_unchecked benchmark with dynamic padding.
  • benches/split_at_unchecked_dynamic_size.rs
    • Added a new benchmark for the split_at_unchecked method on dynamically sized types.
  • benches/split_at_unchecked_dynamic_size.x86-64
    • Added x86-64 assembly output for the split_at_unchecked benchmark with dynamic sizing.
  • benches/split_at_unchecked_dynamic_size.x86-64.mca
    • Added machine code analysis (MCA) output for the split_at_unchecked benchmark with dynamic sizing.
  • benches/split_via_immutable_dynamic_padding.rs
    • Added a new benchmark for the Split::via_immutable method on dynamically padded types.
  • benches/split_via_immutable_dynamic_padding.x86-64
    • Added x86-64 assembly output for the Split::via_immutable benchmark with dynamic padding.
  • benches/split_via_immutable_dynamic_padding.x86-64.mca
    • Added machine code analysis (MCA) output for the Split::via_immutable benchmark with dynamic padding.
  • benches/split_via_immutable_dynamic_size.rs
    • Added a new benchmark for the Split::via_immutable method on dynamically sized types.
  • benches/split_via_immutable_dynamic_size.x86-64
    • Added x86-64 assembly output for the Split::via_immutable benchmark with dynamic sizing.
  • benches/split_via_immutable_dynamic_size.x86-64.mca
    • Added machine code analysis (MCA) output for the Split::via_immutable benchmark with dynamic sizing.
  • benches/split_via_runtime_check_dynamic_padding.rs
    • Added a new benchmark for the Split::via_runtime_check method on dynamically padded types.
  • benches/split_via_runtime_check_dynamic_padding.x86-64
    • Added x86-64 assembly output for the Split::via_runtime_check benchmark with dynamic padding.
  • benches/split_via_runtime_check_dynamic_padding.x86-64.mca
    • Added machine code analysis (MCA) output for the Split::via_runtime_check benchmark with dynamic padding.
  • benches/split_via_runtime_check_dynamic_size.rs
    • Added a new benchmark for the Split::via_runtime_check method on dynamically sized types.
  • benches/split_via_runtime_check_dynamic_size.x86-64
    • Added x86-64 assembly output for the Split::via_runtime_check benchmark with dynamic sizing.
  • benches/split_via_runtime_check_dynamic_size.x86-64.mca
    • Added machine code analysis (MCA) output for the Split::via_runtime_check benchmark with dynamic sizing.
  • benches/split_via_unchecked_dynamic_padding.rs
    • Added a new benchmark for the Split::via_unchecked method on dynamically padded types.
  • benches/split_via_unchecked_dynamic_padding.x86-64
    • Added x86-64 assembly output for the Split::via_unchecked benchmark with dynamic padding.
  • benches/split_via_unchecked_dynamic_padding.x86-64.mca
    • Added machine code analysis (MCA) output for the Split::via_unchecked benchmark with dynamic padding.
  • benches/split_via_unchecked_dynamic_size.rs
    • Added a new benchmark for the Split::via_unchecked method on dynamically sized types.
  • benches/split_via_unchecked_dynamic_size.x86-64
    • Added x86-64 assembly output for the Split::via_unchecked benchmark with dynamic sizing.
  • benches/split_via_unchecked_dynamic_size.x86-64.mca
    • Added machine code analysis (MCA) output for the Split::via_unchecked benchmark with dynamic sizing.
  • src/split_at.rs
    • Updated documentation for split_at_unchecked with codegen section macros.
    • Updated documentation for split_at with codegen section macros.
    • Updated documentation for split_at_mut_unchecked with codegen header macros.
    • Updated documentation for split_at_mut with codegen header macros.
    • Updated documentation for Split::via_immutable with codegen section macros.
    • Updated documentation for Split::via_into_bytes with codegen header macros.
    • Updated documentation for Split::via_unaligned with codegen header macros.
    • Updated documentation for Split::via_runtime_check with codegen section macros.
    • Updated documentation for Split::via_unchecked with codegen section macros.
    • Updated documentation for SplitMut::via_into_bytes with codegen header macros.
    • Updated documentation for SplitMut::via_unaligned with codegen header macros.
    • Updated documentation for SplitMut::via_runtime_check with codegen header macros.
    • Updated documentation for SplitMut::via_unchecked with codegen header macros.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds documentation and tests for code generation related to SplitAt and Split. This is achieved by adding #[derive(SplitAt)] to benchmark structs, introducing new benchmark files, and incorporating codegen_section! and codegen_header! attributes into the documentation of methods in src/split_at.rs. The changes are generally well-executed and align with the PR's objectives. I have a couple of minor suggestions regarding documentation formatting to improve consistency.

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (8514d74) to head (355fd79).

Additional details and impacted files
@@                            Coverage Diff                             @@
##           G597bda54d270c35d807e04218fc99b8deec41473    #3111   +/-   ##
==========================================================================
  Coverage                                      91.87%   91.87%           
==========================================================================
  Files                                             20       20           
  Lines                                           6057     6057           
==========================================================================
  Hits                                            5565     5565           
  Misses                                           492      492           

☔ 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.

@jswrenn jswrenn force-pushed the G09ea59a47925616837b859b2c3cdf7f0f919232e branch 2 times, most recently from a5c1734 to 82b7a65 Compare March 13, 2026 15:21
gherrit-pr-id: G09ea59a47925616837b859b2c3cdf7f0f919232e
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