perf: optimize MappedCrossoverInsertMutator::mutate to eliminate redu…#3742
Open
ayush78490 wants to merge 1 commit intoAFLplusplus:mainfrom
Open
perf: optimize MappedCrossoverInsertMutator::mutate to eliminate redu…#3742ayush78490 wants to merge 1 commit intoAFLplusplus:mainfrom
ayush78490 wants to merge 1 commit intoAFLplusplus:mainfrom
Conversation
…ndant operations This commit addresses issue AFLplusplus#3731 by consolidating redundant input loading and mapping operations in MappedCrossoverInsertMutator::mutate. Previously, the function was: 1. Loading and mapping the corpus input in a first borrow scope to calculate size 2. Getting the same testcase again and loading/mapping it again in a second scope This resulted in: - 2x get_from_all() calls - 2x load_input() calls - 2x input_mapper() invocations - Unnecessary borrow complexity - Reduced code readability CHANGES: - Consolidate input loading and mapping into a single scope - Clone the mapped result to allow early borrow release - Drop testcase borrow before state mutations - Use match statement for cleaner error handling PERFORMANCE IMPACT: - 50% reduction in redundant corpus accesses - 50% reduction in load operations - 50% reduction in mapper invocations - Improved code clarity and maintainability TESTING: All 7 mutation-related tests pass Fixes AFLplusplus#3731
c0265cc to
6b70183
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit addresses issue #3731 by consolidating redundant input loading and mapping operations in MappedCrossoverInsertMutator::mutate.
Previously, the function was:
This resulted in:
CHANGES:
PERFORMANCE IMPACT:
TESTING:
All 7 mutation-related tests pass
Fixes #3731
Description
describe your PR here
Checklist
./scripts/precommit.shand addressed all comments