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
#Asynchronous#JavaScript
🛠
Asynchronous Programming in JavaScript
Asynchronous programming is often intimidating, it’s not how we normally consider writing code. This course shows how promises and async/await can help simplify async programming.
Asynchronous programming is often confusing when first learning JavaScript. In this course, Asynchronous Programming in JavaScript,, you’ll gain the ability to handle async programming in JavaScript. First, you’ll explore consuming promises. Next, you’ll discover creating your own promises. Finally, you’ll learn how to use async/await to handle asynchronous programming. When you’re finished with this course, you’ll have the skills and knowledge of JavaScript promises needed to handle asynchronous code.
📅 1/2023
🔗Link
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----
https://medium.com/@seashorepartners/python-3-6-has-it-redefined-web-development-233165023a36
Python 3.6 — Has it redefined web development?
#Python 3.6 is the biggest ever release by Python, and it starts its enhancements from where Python 3.5 left. Released in December 2016, the world is going gaga over the new release, as the #enhancements help improve speed and performance of your website without compromising on the quality or, the way you have construed your website.
#Asynchronous Functions
https://docs.python.org/3/library/asyncio.html
#asyncio
#Asynchronous programming is more complex than classical “#sequential” programming: see the Develop with asyncio page which lists common traps and explains how to avoid them. Enable the debug mode during development to detect common issues.
https://github.com/szastupov/aiotg
aiotg
https://travis-ci.org/szastupov/aiotg.svg?branch=master
#Asynchronous#Python#API for building Telegram #bots, featuring:
Easy and declarative API
Hassle-free setup - no need for SSL certificates or static IP
Built-in support for analytics via botan.io
Automatic handling of Telegram API throttling or timeouts
http://sahandsaba.com/understanding-asyncio-node-js-python-3-4.html
I spent this summer working on a #web_platform running on #Node.js. This was the first time I worked full-time with Node.js and one thing that became quite apparent after a few weeks of working with it was that many developers, including myself at the time, lack clarify on exactly how the #asynchronous features of Node.js work, and how they are implemented at a lower level. Since I believe the only way to use a platform efficiently is to have a clear understanding of how it works, I decided to dig deeper. This curiosity also made me start playing around with implementing similar asynchronous features in other languages, in particular Python, it being my go-to language for experimenting and learning. This led me to Python 3.4's asynchronous IO library asyncio in particular, which intersected with my already existing interest in coroutines (see my post on combinatorial generation using coroutines in Python.) This post is about exploring the questions and answers that came up while I was learning more about this subject, which I hope can help clarify and answer some questions for others as well.
http://krondo.com/an-introduction-to-asynchronous-programming-and-twisted/
Twisted Introduction
This multi-part series introduces #Asynchronous Programming and the Twisted networking framework.
#Twisted is an event-driven networking engine written in #Python and licensed under the open source MIT license. Twisted runs on Python 2 and an ever growing subset also works with Python 3.
#network#learn
#signal — Set handlers for #asynchronous events
This module provides mechanisms to use signal handlers in Python.
The signal.signal() function allows to define custom handlers to be executed when a signal is received. A small number of default handlers are installed: #SIGPIPE is ignored (so write errors on pipes and sockets can be reported as ordinary Python exceptions) and #SIGINT is translated into a KeyboardInterrupt exception.
#Asyncio
https://docs.python.org/3.4/library/signal.html
https://pypi.python.org/pypi/uvloop
#uvloop is a fast, drop-in replacement of the built-in #asyncio event loop. uvloop is released under the MIT license.
uvloop and asyncio, combined with the power of async/await in Python 3.5, makes it easier than ever to write high-performance #networking code in Python.
uvloop makes asyncio fast. In fact, it is at least 2x faster than #nodejs, #gevent, as well as any other Python #asynchronous framework. The performance of uvloop-based asyncio is close to that of Go programs.
https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#websocket-servers
I've recently been exploring the exciting new world of #asynchronous I/O libraries in Python 3 – specifically asyncio and curio. These two libraries make some different design choices.
Example 1: #asyncio, with callbacks
Example 2: #curio, with #async/#await
Example 3: asyncio, with async/await
#websockets