1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00
Files
egui/crates
Sebastian Reinhard 433d1fc239 file_storage: Wrap File in BufWriter (#3353)
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.
2023-09-18 16:40:29 +02:00
..
2023-09-06 07:59:24 +02:00
2023-09-14 16:33:10 +02:00
2023-09-14 16:33:10 +02:00
2023-09-14 16:33:10 +02:00
2023-09-15 10:57:25 +02:00
2023-04-18 15:52:45 +02:00
2023-09-14 16:33:10 +02:00
2023-09-06 07:59:24 +02:00