В 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
😄Pretty
➖➖➖➖➖➖
🔘Pretty as an adjective means 'attractive, especially when talking about girls or women'.
Margo always tells her daughter that she's pretty.Margo always tells her daughter that she's pretty.
🔜Jacob's mum is really pretty.
🔘Pretty is also used to talk about things that are 'pleasant to look at in a delicate or charming way'. While this is often connected to females, it can also be used to describe something like 'a view'.
🔜There's a very pretty view at the top of that hill.
🔜My friend moved out of the city and bought a pretty cottage in the countryside.
🔘As an adverb, pretty can be an informal way of saying 'quite' or 'rather'.
🔜The house was built recently, it's pretty new.
🔜I enjoyed that film, it was pretty good.
🔘We can also use pretty to give emphasis.
🔜We went to bed at 2am, so we were pretty tired.
🔜I'm pretty angry right now, so don't talk to me.
#Pretty👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
😄Pretty
➖➖➖➖➖➖
🔘Pretty as an adjective means 'attractive, especially when talking about girls or women'.
Margo always tells her daughter that she's pretty.Margo always tells her daughter that she's pretty.
🔜Jacob's mum is really pretty.
🔘Pretty is also used to talk about things that are 'pleasant to look at in a delicate or charming way'. While this is often connected to females, it can also be used to describe something like 'a view'.
🔜There's a very pretty view at the top of that hill.
🔜My friend moved out of the city and bought a pretty cottage in the countryside.
🔘As an adverb, pretty can be an informal way of saying 'quite' or 'rather'.
🔜The house was built recently, it's pretty new.
🔜I enjoyed that film, it was pretty good.
🔘We can also use pretty to give emphasis.
🔜We went to bed at 2am, so we were pretty tired.
🔜I'm pretty angry right now, so don't talk to me.
#Pretty👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
http://www.enlistq.com/10-python-idioms-to-help-you-improve-your-code/
If you have ever tried to learn a new language (not a programming language), you know that we always think in our native language before we translate it to the new language. This can lead to you forming some sentences that don’t make sense in the new language but are perfectly normal in your native language. For example, in a lot of languages, you ‘open’ an electronic gadget such as fan, AC or cell phone. When you say that in English, it means to literally open the gadget instead of turning it on.
The same is true for programming languages. As we pick up new languages, such as #python, we are using our prior knowledge of programming in another language (q, java, c++ etc) and translating that to python. Many times, your code will work but it won’t be ‘#pretty’ or #fast. In python terms, your code won’t be ‘#pythonic’.