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.
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 aBufWriter
, just like we already do withBufReader
.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.I've run
scripts/check.sh
, all checks passed.Closes https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE.I didn't raise an issue first, since this is such a small change. Let me know if you want me to create one.