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

SatInstance::to_dimacs_path slow (unbuffered) #76

Closed
suomela opened this issue Mar 30, 2024 · 1 comment
Closed

SatInstance::to_dimacs_path slow (unbuffered) #76

suomela opened this issue Mar 30, 2024 · 1 comment

Comments

@suomela
Copy link

suomela commented Mar 30, 2024

Some benchmarks on macOS (using a 23MB uncompressed CNF file):

This took ≈ 30 seconds:

instance.to_dimacs_path(filename)?;

This also took ≈ 30 seconds:

let mut f = File::create(filename)?;
instance.to_dimacs(&mut f)?;

But this was only ≈ 0.2 seconds:

let f = File::create(filename)?;
let mut f = BufWriter::new(f);
instance.to_dimacs(&mut f)?;

It looks like to_dimacs_path should wrap things in BufWriter; now it is apparently doing just File::create + to_dimacs, which can be very slow.

@suomela
Copy link
Author

suomela commented Mar 30, 2024

PS. While at it, I noticed that open_compressed_uncompressed_write uses a bit confusingly-named variable raw_reader.

chrjabs added a commit that referenced this issue Apr 2, 2024
chrjabs added a commit that referenced this issue Apr 4, 2024
chrjabs added a commit that referenced this issue Apr 4, 2024
@chrjabs chrjabs closed this as completed in 8799fd1 Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant