Skip to content

Commit b13898a

Browse files
authored
Make Current Input Logging Conditional for Better Performance (#277)
* [performance improvement] add environment config for debug logging of current input and disable it by default * Default LOG_CURRENT_INPUT to true --------- Co-authored-by: Vidas Jocius <vjjocius@users.noreply.github.com>
1 parent 5e24bbc commit b13898a

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/ei/ZestGuidance.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ public class ZestGuidance implements Guidance {
216216
/** Whether to store all generated inputs to disk (can get slowww!) */
217217
protected final boolean LOG_ALL_INPUTS = Boolean.getBoolean("jqf.ei.LOG_ALL_INPUTS");
218218

219+
/** Controls whether to update the .cur_input file with the most recently generated input (disabling improves performance). Defaults to true. */
220+
protected final boolean LOG_CURRENT_INPUT = Boolean.parseBoolean(System.getProperty("jqf.ei.LOG_CURRENT_INPUT", "true"));
221+
219222
// ------------- TIMEOUT HANDLING ------------
220223

221224
/** Timeout for an individual run. */
@@ -710,10 +713,12 @@ public InputStream getInput() throws GuidanceException {
710713
currentInput = parent.fuzz(random);
711714
numChildrenGeneratedForCurrentParentInput++;
712715

713-
// Write it to disk for debugging
714-
try {
715-
writeCurrentInputToFile(currentInputFile);
716-
} catch (IOException ignore) {
716+
// Write current input to disk for debugging
717+
if (LOG_CURRENT_INPUT) {
718+
try {
719+
writeCurrentInputToFile(currentInputFile);
720+
} catch (IOException ignore) {
721+
}
717722
}
718723

719724
// Start time-counting for timeout handling

0 commit comments

Comments
 (0)