Which Python System is affected? (Was: What does the Async Detour usually cost)

2025-06-23 Thread Mild Shock
Hi, I tested this one: Python 3.11.11 (0253c85bf5f8, Feb 26 2025, 10:43:25) [PyPy 7.3.19 with MSC v.1941 64 bit (AMD64)] on win32 I didn't test yet this one, because it is usually slower: ython 3.14.0b2 (tags/v3.14.0b2:12d3f88, May 26 2025, 13:55:44) [MSC v.1943 64 bit (AMD64)] on win32 Bye

Re: async I/O via threads is extremly slow (Was: Does Python Need Virtual Threads?)

2025-06-23 Thread Left Right via Python-list
I honestly have no idea what's being measured, but here are some numbers to compare this to, and then some explanation about async I/O in general. 1. No I/O to a local disk on a modern controller should take milliseconds. The time you are aiming for is below millisecond. That is, writing a block t

What does the Async Detour usually cost (Was: What does stats = await asyncio.to_thread(os.stat, url) do?)

2025-06-23 Thread Mild Shock
Hi, I have some data what the Async Detour usually costs. I just compared with another Java Prolog that didn't do the thread thingy. Reported measurement with the async Java Prolog: > JDK 24: 50 ms (using Threads, not yet VirtualThreads) New additional measurement with an alternative Java Prol

Re: What does stats = await asyncio.to_thread(os.stat, url) do? (Was async I/O via threads is extremly slow)

2025-06-23 Thread Inada Naoki via Python-list
Other languages uses thread pool, instead of creating new thread. In Python,loop.run_in_executor uses thread pool. https://docs.python.org/3.13/library/asyncio-eventloop.html#asyncio.loop.run_in_executor 2025年6月24日(火) 8:12 Mild Shock : > > So what does: > > stats = await asyncio.to_thread(os.sta

What does stats = await asyncio.to_thread(os.stat, url) do? (Was async I/O via threads is extremly slow)

2025-06-23 Thread Mild Shock
So what does: stats = await asyncio.to_thread(os.stat, url) Whell it calls in a sparate new secondary thread: os.stat(url) It happends that url is only a file path, and the file path points to an existing file. So the secondary thread computs the stats, and terminates, and the async framework

async I/O via threads is extremly slow (Was: Does Python Need Virtual Threads?)

2025-06-23 Thread Mild Shock
Hi, async I/O in Python is extremly disappointing and an annoying bottleneck. The problem is async I/O via threads is currently extremly slow. I use a custom async I/O file property predicate. It doesn't need to be async for file system access. But by some historical circumstances I made it asy