Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImprovements and simplification in corpus' handling randomisation code #22
Conversation
- Remove useless casts to bool - Use something faster than random.randint: this cuts in half the time spent in the random.py file, without raising anything else - use random.choice where possible, instead of `mylist[_rand(len(mylist))]` - Add some comments explaining the if…if…else structure, to prevent future refactoring from transforming them into an if…elif…else On a local fuzzer, with 10000 iterations, this decrease the amount of time spent in corpus' mutate function from ~0.2 seconds to ~0.1 seconds, for a total run time of ~9 seconds, which seems to not be a lot, but since 8.60s is spent in connection.py's poll function waiting for the fuzzer, it's a worthy optimization.
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.
jvoisin commentedDec 31, 2019
in the random.py file, without raising anything else
mylist[_rand(len(mylist))]future refactoring from transforming them into an if…elif…else
On a local fuzzer, with 10000 iterations, this decrease the amount of time
spent in corpus' mutate function from ~0.2 seconds to ~0.1 seconds, for a total
run time of ~9 seconds, which seems to not be a lot, but since 8.60s is spent
in connection.py's poll function waiting for the fuzzer, it's a worthy
optimization.