7.09.2025 состоялся релизPithon 3.14!
На фоне хайпа про NoGIL всё позабыли про другие фичи. Особенно про Multiple Interpreters, который обещает изоляцию процессов но с эффективностью потоков! На сколько действительно это будет эффективно мы узнаем позже, потому что сейчас это лишь первый релиз с ограничениями и недоработками.
Но что там про NoGIL? Теперь этот режим не экспериментальный, а официально поддерживаемый, но опциональный.
Чтобы запустить без GIL нужна специальная сборка. И перед стартом нужно объявить переменную PYTHON_GIL=0
Для вас я собрал готовый репозиторий где достаточно запустить скрпит, который всё сделает:
▫️ соберет релизный Python 3.14 в новый Docker-образ
▫️ запустит тесты в контейнере (GIL, NoGIL, MultiInterpreter)
▫️ распечатает результаты
Тест очень простой, усложняйте сами)
Вот какие результаты у меня:
=== Running ThreadPoolExecutor GIL ON
TOTAL TIME: 45.48 seconds
=== Running ThreadPoolExecutor GIL OFF
TOTAL TIME: 6.14 seconds
=== Running basic Thread GIL ON
TOTAL TIME: 45.54 seconds
=== Running basic Thread GIL OFF
TOTAL TIME: 4.74 seconds
=== Running with Multi Interpreter
TOTAL TIME: 18.30 seconds
Если сравнивать GIL и NoGIL, то на мои 32 ядра прирост х7-x10 (почему не х32? 🤷). При этом нам обещают что скорости будут расти с новыми релизами.
Режим без GIL похож (визуально) на async, тоже параллельно, тоже не по порядку. Но это не IO! и от того некоторый диссонанс в голове 😵💫, нас учили не так!
Интересно, что чистый Thread работает быстрей чем ThreadPoolExecutor без GIL.
Ну и где-то плачет один адепт мульти-интерпретаторов😭 Теперь нужно искать где они могут пригодиться с такой-то скоростью. Скорее всего своя область применения найдется.
Отдельно я затестил память и вот что вышло на 32 потока:
ThreadPoolExecutor GIL ON
305.228 MB
ThreadPoolExecutor GIL OFF
500.176 MB
basic Thread GIL ON
90.668 MB
basic Thread GIL OFF
472.444 MB
with Multi Interpreter
1267.788 MB
Пока не знаю как к этому относиться)
В целом - радует направление развития!
#release
Был бы у меня такой кот, я, может, и не женился бы никогда.
If I had a cat like that, I might never have gotten married.
• Может
[mo-zhyt]
Maybe, perhaps, probably, might
🔻This introductory word expressing possibility or probability is set off by commas in a sentence.
😉С пятницей, товарищи!
#just_a_joke
#just_cats
#punctuation
#Friday
😎 Stay with @learnRCRussian
Did you know that Spanish 🇪🇸 uses upside down exclamation and question marks (¡ and ¿) at the beginning of sentences?
¡Qué bonito! ("How beautiful!")
¿Cómo estás? ("How are you?")
Creo que tienes razón, pero ¿estás completamente seguro?
("I think you're right, but are you completely sure?")
Below you'll find a block of questions on these upside down punctuation marks.
For each question react with 👍🏻 if you got it right and 🙈 if you got it wrong.
@languagetrivia#question_block#punctuation
In the world of printing and journalism, the exclamation mark (!) has earned a variety of colorful nicknames. One of these humorous terms compares its shape to a specific part of a dog’s anatomy.
Sometimes an exclamation mark is humorously referred to as “a dog’s [what]"?
A) Tail 🐕
B) Nose 👃
C) Bone 🦴
D) C*ck🍆
Take the quiz below to find out
@languagetrivia#punctuation#symbol#slang
✏️Did you know about the Oxford comma, also known as the serial comma?
It's the final comma in a list of three or more items, placed before "and" or "or."
For example:
🔵I invited my parents, Taylor Swift, and Elon Musk.
Without the Oxford comma, it could look like this:
🔵I invited my parents, Taylor Swift and Elon Musk.
Wait, are my parents Taylor Swift and Elon Musk?! 😅
Not everyone agrees on its usage:
🟢Proponents argue it provides clarity and prevents ambiguity 📝
🟣Opponents feel it’s unnecessary in straightforward cases and takes up space 📰
For instance, the AP Stylebook often skips it unless absolutely needed, but the Chicago Manual of Style recommends using it in all cases.
Here are some examples showing how the Oxford comma can help fight ambiguity:
1️⃣Avoiding Misinterpretation:
I dedicate this book to my parents, Mother Teresa, and the pope.
Without the Oxford comma: I dedicate this book to my parents, Mother Teresa and the pope.
This could imply that your parents are Mother Teresa and the pope. 😳
2️⃣Clarifying Groupings:
We had coffee, cheese and crackers, and grapes.
Without the Oxford comma: We had coffee, cheese and crackers and grapes.
This could suggest that "crackers and grapes" are a combined dish. 🍇🧀
3️⃣Costly Consequences:
O'Connor v. Oakhurst Dairy (2017) was a U.S. legal case where truck drivers sued for overtime pay, challenging an ambiguous Maine law that lacked an Oxford comma. The law exempted work involving "packing for shipment or distribution" of goods.
Without a comma, it was unclear if "distribution" was part of "packing" or a separate activity. The court sided with the drivers, interpreting the ambiguity in their favor, leading to a $5 million payout. 💸
📌Ultimately, whether or not you use the Oxford comma is up to you, but the key is to be consistent. And it's also a good idea to use it in cases where it can help prevent ambiguity and misinterpretation!
Sources: Grammarly |Wikipedia
Tap ❤️ if you found this interesting
@languagetrivia#grammar#punctuation#fact