Skip to content

optimize(mutators): eliminate redundant borrowing and double mapping …#3736

Closed
Aditya30ag wants to merge 1 commit intoAFLplusplus:mainfrom
Aditya30ag:optimize/mapped-crossover-insert
Closed

optimize(mutators): eliminate redundant borrowing and double mapping …#3736
Aditya30ag wants to merge 1 commit intoAFLplusplus:mainfrom
Aditya30ag:optimize/mapped-crossover-insert

Conversation

@Aditya30ag
Copy link
Copy Markdown
Contributor

@Aditya30ag Aditya30ag commented Feb 20, 2026

Description

This PR refactors and simplifies the logic inside MappedCrossoverInsertMutator by restructuring how mapped_other_input and other_size are derived.

Key Changes:

  • Compute (mapped_other_input, other_size) together in a single scoped block.
  • Avoid reloading and remapping the input multiple times.
  • Remove redundant checks and repeated borrowing of other_testcase.
  • Use as_ref().map_or(0, Vec::<u8>::len) to safely compute size without consuming the mapped input.
  • Unwrap mapped_other_input only after validating size constraints.

Benefits:

  • Reduces duplicated logic and unnecessary re-borrowing.
  • Improves readability and control flow clarity.
  • Slight performance improvement by avoiding repeated corpus/input loading.
  • Keeps mutation semantics unchanged.

No functional behavior was altered this is strictly a cleanup and structural improvement.
Issue closing #3731

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

@domenukk
Copy link
Copy Markdown
Member

domenukk commented Apr 7, 2026

Please fix CI

@Aditya30ag Aditya30ag force-pushed the optimize/mapped-crossover-insert branch from 1a8cba8 to 6952417 Compare April 8, 2026 09:48
Updates the requirements on [ctor](https://github.com/mmastrac/rust-ctor) to permit the latest version.
- [Commits](https://github.com/mmastrac/rust-ctor/commits)

---
updated-dependencies:
- dependency-name: ctor
  dependency-version: 0.8.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Aditya30ag <adityaagrwal3005@gmail.com>
@Aditya30ag Aditya30ag force-pushed the optimize/mapped-crossover-insert branch from 6952417 to ff2aa55 Compare April 8, 2026 09:50
@Aditya30ag Aditya30ag closed this Apr 8, 2026
@Aditya30ag Aditya30ag deleted the optimize/mapped-crossover-insert branch April 8, 2026 09:53
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