В 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
🪐 In 2022, scientists used data from the Atacama Cosmology Telescope in Chile to make the sharpest-ever map of the cosmic microwave background’s subtle temperature patterns. This ancient light, which blankets galaxies like our Milky Way, holds whisper-faint traces left by the first matter clumps—revealing how gravity, even in the universe’s earliest moments, started pulling atoms together to form all the cosmic structures we see today. ✨
#microwave⚡#background⚡#universe⚡#gravity⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The cosmic microwave background (CMB) is a faint glow that fills the universe, left over from when the cosmos was just 380,000 years old. Tiny temperature differences in the CMB, first mapped in detail by the Planck satellite, reveal subtle "hot" and "cold" spots—clues to how galaxies, like the Milky Way and Andromeda, began to form from small ripples in the early universe. ✨
#microwave⚡#background⚡#universe⚡#Planck⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 The cosmic microwave background contains faint "Sunyaev-Zel’dovich effects," which happen when the ancient microwave light passes through hot gas in galaxy clusters like the Bullet Cluster. This process boosts the energy of some photons (light particles), leaving tiny shadows in the background glow—allowing astronomers to map both distant galaxy clusters and the hot plasma between galaxies by studying these subtle marks in the oldest light in the universe. ✨
#microwave⚡#background⚡#galaxyclusters⚡#plasma⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels