Mo :ferris: :tux: @ FOSDEM on Nostr: #RustLang performance tip 🚀 Rewinding, truncating and then writing to an open file ...
#RustLang performance tip 🚀
Rewinding, truncating and then writing to an open file is always faster than opening the file every time.
For small files, it can be about 3x faster.
If you write a file multiple times, keep it open and reuse it, but don't forget to rewind and truncate.
Shouldn't be specific to Rust.
Published at
2024-08-29 00:10:02Event JSON
{
"id": "aaabb456d7509c1eaddafb288fc34f2905dae3e5248d94e3784e861a159ae6ae",
"pubkey": "979383f8767c5d795fcad86f82dc7b38b384c1a473710c433014dc2c0fb0e359",
"created_at": 1724890202,
"kind": 1,
"tags": [
[
"t",
"rustlang"
],
[
"proxy",
"https://fosstodon.org/users/mo8it/statuses/113042404289682982",
"activitypub"
]
],
"content": "#RustLang performance tip 🚀\n\nRewinding, truncating and then writing to an open file is always faster than opening the file every time.\n\nFor small files, it can be about 3x faster.\n\nIf you write a file multiple times, keep it open and reuse it, but don't forget to rewind and truncate.\n\nShouldn't be specific to Rust.\n\nhttps://cdn.fosstodon.org/media_attachments/files/113/042/370/236/545/862/original/2fe2d525da11a3c5.png\n\nhttps://cdn.fosstodon.org/media_attachments/files/113/042/372/918/233/825/original/a5a0dec95bce1a65.png",
"sig": "63978985935369deb4aa4f23bf51baa6ed2d8958182ef8d498f930036a1323723a22f67523d6cd8ee9e5f13b04ebd062915191e74401a5229145f8ec9820ff32"
}