frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

In-Memory Filesystems in Rust

https://andre.arko.net/2025/08/18/in-memory-filesystems-in-rust/
35•ingve•1d ago

Comments

adastra22•1d ago
I no mention of fsync/sync_all. That’s why your disk file system is acting as fast as your in memory file system (for small tests). Both are effectively in-memory.
maxbond•3h ago
A Rust-specific danger is that, if you don't explicitly sync a file before dropping it, any errors from syncing are ignored. So if you care about atomicity, call eg `File::sync_all()`.
dezgeg•2h ago
Is that really rust-specific? I would be really surprised if any other languages do fsync() in their destructor either
maxbond•2h ago
To be clear `File::drop()` does sync, it just ignores errors (because `drop()` doesn't have a way of returning an error). It's not really Rust specific I guess, I just don't know off the top of my head what other languages behave this way.
aw1621107•55m ago
I believe C++'s fstreams also ignore errors on destruction for similar reasons.

I've wondered for a while what it'd take to eliminate such pitfalls in the "traditional" RAII approach. Something equivalent to deleting the "normal" RAII destructor and forcing consumption via a close() could be interesting, but I don't know how easy/hard that would be to pull off.

the8472•2m ago
[delayed]
01HNNWZ0MV43FF•2h ago
For context - cppreference.com doesn't say anything about `fstream` syncing on drop, but it does have an explicit `sync` function. `QFile` from Qt doesn't even have a sync function, which I find odd.
aw1621107•29m ago
I had always assumed that fstream flushes on destruction, but after digging through the standard all I can conclude is that I'm confused.

According to the standard, fstream doesn't have an explicit destructor, but the standard says "It uses a basic_filebuf<charT, traits> object to control the associated sequences." ~basic_filebuf(), in turn, is defined to call close() (which I think flushes to disk?) and swallow exceptions.

However, I can't seem to find anything that explicitly ties the lifetime of the fstream to the corresponding basic_filebuf. fstream doesn't have an explicitly declared destructor and the standard doesn't require that the basic_filebuf is a member of fstream, so the obvious ways the file would be closed don't seem to be explicitly required. In addition, all of fstream's parents' destructors are specified to perform no operations on the underlying rdbuf(). Which leaves... I don't know?

cppreference says the underlying file is closed, though, which should flush it. And that's what I would expect for an RAII class! But I just can't seem to find the requirement...

silon42•2h ago
I'd almost never want do to fsync in normal code (unless implementing something transactional)... but I'd want an explicit close almost always (or drop should panic/abort).
znpy•1h ago
so the good old `sync; sync; sync;` ?
goodpoint•49m ago
This is not correct. Programming languages do not and should not call sync automatically.
the8472•7m ago
[delayed]
indirect•2h ago
I guess I wasn't sufficiently clear in the post, but the part I think is interesting is not that tmpfs and SSD bench at the same speed. I am aware of in-memory filesystem caches, and explicitly mention them twice in the last few paragraphs.

The interesting part, to me, was that using the vfs crate or the rsfs crate didn't produce any differences from using tmpfs or an SSD. In theory, those crates completely cut out the actual filesystem and the OS entirely. Somehow, avoiding all those syscalls didn't make it any faster? Not what I expected.

Anyway, if you have examples of in-process filesystem mocks that run faster than the in-memory filesystem cache, I'd love to hear about them.

eumon•2h ago
you may try /dev/shm for the testing purpose, which is effectively an in memory filesystem that linux provides, it is very performant
j1elo•57m ago
> It turns out the intended primary use case of the crate is to store files inside Rust binaries but still have an API sort of like the filesystem API to interact with them. Unfortunately, that information is hidden away in a comment on a random GitHub issue, rather than included in the project readme.

A+ on technical prowess,

F- on being able to articulate a couple words about it on a text file.

kolektiv•38m ago
It always surprised me somewhat that there isn't a set of traits covering some kind of `fs` like surface. It's not a trivial surface, but it's not huge either, and I've also found myself in a position of wanting to have multiple implementations of a filesystem-like structure (not even for the same reasons).

Tricky to make that kind of change to std lib now I appreciate, but it seems like an odd gap.

What are OKLCH colors?

https://jakub.kr/components/oklch-colors
192•tontonius•3h ago•52 comments

Git-Annex

https://git-annex.branchable.com/
97•keepamovin•5h ago•18 comments

SmallJS: Smalltalk-80 that compiles to JavaScript

https://small-js.org/Home/Home.html
27•mpweiher•1d ago•5 comments

MCP Gateway and Registry

https://github.com/IBM/mcp-context-forge
37•nikhilk218•4h ago•17 comments

Ban me at the IP level if you don't like me

https://boston.conman.org/2025/08/21.1
256•classichasclass•5h ago•157 comments

Buypass Discontinues Issuance of TLS/SSL Certificates

https://www.buypass.com/products/tls-ssl-certificates/discontinues-issuance-of-tls-ssl-certificates
22•gpi•3h ago•18 comments

Busy beaver hunters reach numbers that overwhelm ordinary math

https://www.quantamagazine.org/busy-beaver-hunters-reach-numbers-that-overwhelm-ordinary-math-202...
125•defrost•2d ago•38 comments

In-Memory Filesystems in Rust

https://andre.arko.net/2025/08/18/in-memory-filesystems-in-rust/
36•ingve•1d ago•14 comments

Show HN: Sping – An HTTP/TCP latency tool that's easy on the eye

https://dseltzer.gitlab.io/sping/docs/
124•zorlack•9h ago•14 comments

The Unix-Haters Handbook (1994) [pdf]

https://simson.net/ref/ugh.pdf
75•oliverkwebb•8h ago•20 comments

We put a coding agent in a while loop

https://github.com/repomirrorhq/repomirror/blob/main/repomirror.md
237•sfarshid•17h ago•151 comments

Is 4chan the perfect Pirate Bay poster child to justify wider UK site-blocking?

https://torrentfreak.com/uk-govt-finds-ideal-pirate-bay-poster-boy-to-sell-blocking-of-non-pirate...
258•gloxkiqcza•17h ago•340 comments

From Hackathon to YC

https://www.producthunt.com/p/april-yc-s25/from-hackathon-to-yc
41•rmason•11h ago•16 comments

Show HN: CasCache – multi-generational cache with optimistic concurrency control

https://github.com/unkn0wn-root/cascache
4•unkn0wn_root•22h ago•0 comments

Burner Phone 101

https://rebeccawilliams.info/burner-phone-101/
362•CharlesW•4d ago•155 comments

Uncle Sam shouldn't own Intel stock

https://www.wsj.com/opinion/uncle-sam-shouldnt-own-intel-stock-ccd6986d
182•aspenmayer•11h ago•164 comments

The two versions of Parquet

https://www.jeronimo.dev/the-two-versions-of-parquet/
172•tanelpoder•3d ago•34 comments

Trees on city streets cope with drought by drinking from leaky pipes

https://www.newscientist.com/article/2487804-trees-on-city-streets-cope-with-drought-by-drinking-...
183•bookofjoe•2d ago•95 comments

Making games in Go: 3 months without LLMs vs. 3 days with LLMs

https://marianogappa.github.io/software/2025/08/24/i-made-two-card-games-in-go/
299•maloga•18h ago•199 comments

Claim: GPT-5-pro can prove new interesting mathematics

https://twitter.com/SebastienBubeck/status/1958198661139009862
175•marcuschong•4d ago•101 comments

A Brilliant and Nearby One-off Fast Radio Burst Localized to 13 pc Precision

https://iopscience.iop.org/article/10.3847/2041-8213/adf62f
74•gnabgib•14h ago•14 comments

Everything I know about good API design

https://www.seangoedecke.com/good-api-design/
286•ahamez•14h ago•108 comments

A bubble that knows it's a bubble

https://craigmccaskill.com/ai-bubble-history
89•craigmccaskill•11h ago•61 comments

Cloudflare incident on August 21, 2025

https://blog.cloudflare.com/cloudflare-incident-on-august-21-2025/
176•achalshah•3d ago•34 comments

Show HN: Clearcam – Add AI object detection to your IP CCTV cameras

https://github.com/roryclear/clearcam
182•roryclear•21h ago•49 comments

YouTube made AI enhancements to videos without warning or permission

https://www.bbc.com/future/article/20250822-youtube-is-using-ai-to-edit-videos-without-permission
99•jakub_g•22h ago•59 comments

Show HN: I Built a XSLT Blog Framework

https://vgr.land/content/posts/20250821.xml
64•vgr-land•15h ago•29 comments

Y Combinator files brief supporting Epic Games, says store fees stifle startups

https://www.macrumors.com/2025/08/21/y-combinator-epic-games-amicus-brief/
175•greenburger•3d ago•161 comments

Stepanov's biggest blunder? The curious case of adjacent difference

https://mmapped.blog/posts/43-stepanovs-biggest-blunder
60•signa11•3d ago•12 comments

Ghrc.io appears to be malicious

https://bmitch.net/blog/2025-08-22-ghrc-appears-malicious/
340•todsacerdoti•10h ago•52 comments