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

Optimize a tiny bit the pipe connections #43

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Optimize a tiny bit the pipe connections

This yields a couple of percent in performances, by bypassing:
- a check to see if the connection is open
- a check to see if the connection is writeable/readable
- a call to memoryview()
- a bunch of conditions
  • Loading branch information
jvoisin committed Jun 10, 2020
commit 4a1079ace11da5ef44ba83e4bb139d3bc41de454
@@ -37,7 +37,7 @@ def write(self, x):

sys.settrace(tracer.trace)
while True:
buf = child_conn.recv_bytes()
buf = child_conn._recv_bytes().getvalue()
try:
target(buf)
except Exception as e:
@@ -46,7 +46,7 @@ def write(self, x):
child_conn.send(e)
break
else:
child_conn.send_bytes(b'%d' % tracer.get_coverage())
child_conn._send_bytes(b'%d' % tracer.get_coverage())


class Fuzzer(object):
@@ -127,7 +127,7 @@ def start(self):
break

buf = self._corpus.generate_input()
parent_conn.send_bytes(bytes(buf))
parent_conn._send_bytes(bytes(buf))
if not parent_conn.poll(self._timeout):
self._p.terminate()
logging.info("=================================================================")
@@ -136,7 +136,7 @@ def start(self):
break

try:
total_coverage = int(parent_conn.recv_bytes())
total_coverage = int(parent_conn._recv_bytes().getvalue())
except ValueError:
self.write_sample(buf)
break
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.