forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dimacs: make sure printing a dimacs is fast
Use stringstreams and print their content to the actual stream only once in a while to make printing formulas faster.
- Loading branch information
1 parent
7e00a30
commit 0afcf90
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "dimacs_cnf.h" | ||
|
||
#include <util/magic.h> | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
|
||
dimacs_cnft::dimacs_cnft():break_lines(false) | ||
{ | ||
|
@@ -60,9 +63,23 @@ static void write_dimacs_clause( | |
|
||
void dimacs_cnft::write_clauses(std::ostream &out) | ||
{ | ||
std::size_t count = 0; | ||
std::stringstream output_block; | ||
for(clausest::const_iterator it=clauses.begin(); | ||
it!=clauses.end(); it++) | ||
write_dimacs_clause(*it, out, break_lines); | ||
{ | ||
write_dimacs_clause(*it, output_block, break_lines); | ||
|
||
// print the block once in a while | ||
if(++count % CNF_DUMP_BLOCK_SIZE == 0) | ||
{ | ||
out << output_block.str(); | ||
output_block.str(""); | ||
} | ||
} | ||
|
||
// make sure the final block is printed as well | ||
out << output_block.str(); | ||
} | ||
|
||
void dimacs_cnf_dumpt::lcnf(const bvt &bv) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters