Use FILE * instead of filenames when passing file paths to serialization and printing commands #968
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.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we were storing a filename in a global variable and then passing it to a bunch of functions. Each of these functions then had to call fopen and fclose, which was quite expensive. This PR changes the behavior so instead we once open a file with fopen at the start of rewriting, then call a bunch of functions which take a
FILE *
as an argument, then call fclose once at the end. This gets much better buffering behavior and reduces the number of syscalls considerably.When measuring the performance of this code against a "sum to 10k" imp program with proof hint generation enabled, we saw a time reduction from 3.5m to 2m.