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

tmin: Proposing del_len option for improved speed #431

Closed
gnbon opened this issue Mar 12, 2024 · 2 comments · Fixed by #432
Closed

tmin: Proposing del_len option for improved speed #431

gnbon opened this issue Mar 12, 2024 · 2 comments · Fixed by #432

Comments

@gnbon
Copy link
Contributor

gnbon commented Mar 12, 2024

Issue

Block deletion in the tmin stage is a time-consuming task that scales with the size of the file.

Background

winafl/afl-tmin.c

Lines 911 to 923 in 25d5840

del_len = next_p2(in_len / TRIM_START_STEPS);
stage_o_len = in_len;
ACTF(cBRI "Stage #1: " cRST "Removing blocks of data...");
next_del_blksize:
if (!del_len) del_len = 1;
del_pos = 0;
prev_del = 1;
SAYF(cGRA " Block length = %u, remaining size = %u\n" cRST,
del_len, in_len);

As del_len, the unit for reducing unnecessary blocks, decreases by powers of two, the operation takes longer. However, there are instances
where speed is more critical than achieving minimal minimization.

winafl/afl-tmin.c

Lines 968 to 971 in 25d5840

if (del_len > 1 && in_len >= 1) {
del_len /= 2;
goto next_del_blksize;

Currently, the minimum value of del_len is 1. However, increasing the minimum value would result in faster speeds.

proposal

Therefore, I propose allowing del_len to be specified as an option.

Alternatively, a method could be implemented to terminate the process if there is no reduction of even 1 byte, or if the reduction is less than n bytes, in a given cycle.

@gnbon gnbon changed the title tmin: proposing del_len option for improved speed in block deletion of tmin stage tmin: Proposing del_len option for improved speed in block deletion of tmin stage Mar 12, 2024
@gnbon gnbon changed the title tmin: Proposing del_len option for improved speed in block deletion of tmin stage tmin: Proposing del_len option for improved speed Mar 12, 2024
@ifratric
Copy link
Collaborator

Hi, if this is something you'd like to fix, please go ahead and and submit a pull request.

@gnbon
Copy link
Contributor Author

gnbon commented Mar 13, 2024

Okey. I implemented the feature and submitted the pull request. How does it look?

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 a pull request may close this issue.

2 participants