В Linux стандартными средствами можно использовать часть оперативной памяти как диск. Для этого требуется указать тип монтирования tmpfs в команде mount
mount -t tmpfs -o size=5G tmpfs /mnt/ram
Теперь путь /mnt/ram можно использовать как обычный каталог. Для чего это может быть нужно?
▫️ Скорость работы с таким каталогом выше чем многие SSD и тем более HDD.
▫️ Если у вас очень быстрый SSD на NVMe M.2 то такой способ особо не прибавит вам скорости, но поможет сохранить ресурс SSD когда требуется обрабатывать очень много мелких файлов и оперативка позволяет выделить нужный объем.
▫️ Оперативка это энергозависимая память, поэтому выключении питания все файлы безвозвратно теряются. Такой "non persistent" каталог гарантирует удаление временных файлов.
Я написал небольшой скрипт для условного теста и сравнения скорости копирования файлов между SSD и RAM.
Вот мои результаты:
Single File Size: 30.0Gb
ssd > ssd: 0:00:12.850 / 2.3Gb/s
sdd > ram: 0:00:06.453 / 4.6Gb/s
ram > ram: 0:00:06.995 / 4.3Gb/s
ram > sdd: 0:00:06.217 / 4.8Gb/s
Dir size: 32.7Gb, File count: 11127
ssd > ssd: 0:00:15.063 / 2.2Gb/s
sdd > ram: 0:00:08.486 / 3.9Gb/s
ram > ram: 0:00:08.032 / 4.1Gb/s
ram > sdd: 0:00:07.026 / 4.7Gb/s
Скрипт для теста ↗️
На моём железе прирост скорости ~2x. Плюс экономия ресурса SSD.
В Windows такой фишки по умолчанию нет, но обязательно найдутся аналогичные решения
#linux#triks
Let’s unlock all your Rat-Dex discoveries! Spot the signs early so we can stop them before they multiply. Help your neighbourhood stay rat-free by reporting signs of rat activity through the OneService app. #KeepSGClean
Don’t dump furniture at void decks or common areas.
🏢 HDB → Contact your Town Council
🏠 Private estate → Contact a public waste collector
Bulky items deserve proper disposal—keep our shared spaces safe & clean 🌍💚
#KeepSGClean
Cups and containers left behind in our shared spaces can trap water and turn into mozzie breeding spots. Pack up your litter, throw them into the bin and #KeepSGClean!
High-rise litter isn’t just messy; it’s dangerous. Let’s keep our shared spaces safe and clean. If you spot litterbugs, report them via the OneService app with details like date, time and location.
#KeepSGClean
Barbecue parties are fun, but piles of litter after aren’t. Food scraps & waste attract pests and make shared spaces unpleasant.
Let’s do our part and bin our waste. Spot someone leaving a mess? Report via the OneService app with date, time & exact location. Let’s keep our chill spots truly chill! #KeepSGClean
The food slapped 😋, but your leftovers? Not so much. Improper disposal of food waste = pests, smells, and fines up to $2,000. Let’s clear our mess before we leave and report littering via the OneService app with details such as date, time and precise location. #KeepSGClean
Your game might be 🔥 but leaving trash behind in public sports facilities is a major foul. Offenders can be fined up to $2,000 for first-time littering.
If you spot litterbugs, report them via the OneService app with details such as date, time and precise location. Let's keep our public sports facilities clean for everyone's game! #KeepSGClean
Pests, like rats, love their new homes within bulky waste. Do you? 🐀
To rid them of their new homes, keep public spaces clear of food and clutter!
HDB: Contact your Town Council
Private homes: Engage licensed collector 👉go.gov.sg/licensed-waste-collectors
Spot bulky waste left in common areas? Report via the OneService app with details such as date, time and precise location (block stack or column). Together, let’s #KeepSGClean!
Clean spaces protect our peace of mind ✨ Dispose of waste responsibly and help keep our shared areas uplifting for all.
Witness littering? Report it via the OneService app with details such as date, time and precise location. Together, let’s #KeepSGClean!