Skip to the content.

Paranoia Mode

All day long I think of things
But nothing seems to satisfy
Think I’ll lose my mind if I don’t
Find something to pacify

In production, Byron is typically run from a non-interactive script, for example on a server with ssh access. In this context, performance is critical, while verbosity should be minimal. During setup, on the other hand, the user needs to check the various parameters and the coherence of the constraints. Here, speed is not essential, while warnings and hints can be quite useful.

Can you help me occupy my brain?
Oh, yeah

Byron’s paranoia checks are computationally intensive routines that thoroughly analyze and verify both the integrity of internal data structures and parameter values, and provide error messages and hints. Paranoia checks are intended to be used during setup and are automatically removed when an optimization flag is specified..

Terminal

If paranoia checks are enabled, the user is warned of the potential, indeed almost certain, loss in performance:

Paranoia checks are enabled: performances can be significantly impaired

Possible solutions:

Use -O flag

Using an optimization flag will disable Paranoia Checks:

$ python -O ./super-fuzzer.py

Set PYTHONOPTIMIZE

Setting the environment variable PYTHONOPTIMIZE to a non-empty string it is equivalent to specifying the -O option:

$ PYTHONOPTIMIZE=1 python ./super-fuzzer.py

Jupyter Notebooks

By default, code run in IPython is not optimized. Byron should detect when it is executed within a Jupyter Notebook and show a warning:

Paranoia checks are enabled in this notebook: performances can be significantly impaired

Possible solutions:

Export to a script

Probably the best solution:

Set PYTHONOPTIMIZE

Set PYTHONOPTIMIZE before starting Jupyter:

$ PYTHONOPTIMIZE=1 jupyter-notebook

⚠️ This will disable every single assert in notebooks: the behavior of other modules will be affected as well.

Use magic

Jupyter allows some of the IPython’s magics, and a cell magic (%%) can be used to start a Python interpreter with the optimization flag:

%%python -O

import byron

# Fuzzer code

Tamper with the bytecode cache đź’Ł

⚠️ This hack may cause your system to become unstable and provide incorrect results. You acknowledge that you are solely responsible for any harm or damage that may result.