←back to thread

62 points hiAndrewQuinn | 2 comments | | HN request time: 0s | source
Show context
ctur ◴[] No.44392592[source]
This is an unnecessary optimization, particularly for the article's use case (small files that are read immediately after being written). Just use /tmp. The linux buffer cache is more than performant enough for casual usage and, indeed, most heavy usage too. It's far too easy to clog up memory with forgotten files by defaulting to /dev/shm, for instance, and you potentially also take memory away from the rest of the system until the next reboot.

For the author's purposes, any benefit is just placebo.

There absolutely are times where /dev/shm is what you want, but it requires understanding nuances and tradeoffs (e.g. you are already thinking a lot about the memory management going on, including potentially swap).

Don't use -funroll-loops either.

replies(5): >>44392628 #>>44392716 #>>44392880 #>>44393209 #>>44393478 #
chaps ◴[] No.44392628[source]
This isn't great advice because /tmp is not always mounted as tmpfs.

I've used /dev/shm extensively for large datasets and it's consistently been a massive speed improvement. Not sure what you're talking about.

replies(1): >>44392637 #
1. quotemstr ◴[] No.44392637[source]
> This isn't great advice because /tmp is not always mounted as tmpfs.

Well, complain to whoever's mounting it wrong to fix it.

replies(1): >>44392669 #
2. chaps ◴[] No.44392669[source]
Not sure your aggression is warranted, friend. Many distros over the years have had tmpfs mounted and many distros over the years haven't.

Some hosts should have tmpfs mounted and some shouldn't. For those that don't, I can just /dev/shm. This isn't a "right" or "wrong" sorta thing.