Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When exiting my application, it would freeze for around a minute waiting to finish writing ca. 40MB to file storage. Some quick profiling revealed that it was spending all that time in `File::write`, presumably making a large number of system calls writing tiny amounts of data at a time. We can avoid this by buffering writes using a `BufWriter`, just like we already do with `BufReader`. With this change, my application takes around 1-2 seconds to exit, with the majority of that time spent serializing `ron`. I'm sure there are further potential performance improvements there, but this is already an order of magnitude or two better. I also fixed the call to `log::warn!`, which was using incorrect formatting syntax and not including the error message.
- Loading branch information