Add create_datagram_endpoint api - #52
Conversation
|
@codspeedbot explain why this is faster |
Why
|
| Metric | BASE (ebd3b00) |
HEAD (11566a2) |
|---|---|---|
| Self time | 175.1 µs | 104.9 µs |
| Total time | 313.7 µs | 188.5 µs |
| Self-time cache misses | 30.7 µs | 18.6 µs |
This lines up with the transport rewrite in the diff: SocketTransport was split into a SocketTransportBase, the write/watermark logic was reorganized (_maybe_pause_protocol / _ensure_writer / _drop_writer inlined helpers), and notably the large inline aiofn_iovec _iovecs[256] array was removed from the transport struct. Shrinking that per-transport structure improves data-cache locality, which shows up as the drop in cache-miss time above.
2. The event loop did slightly less work
The uv__io_poll → __on_uvpoll_event path dropped from 1.4 ms (45%) to 1.1 ms (40%), with one fewer poll event (4 → 3) and one fewer protocol callback cycle (14 → 15 vs the base's counts). So part of the win is simply a marginally different number of loop iterations to move the same data.
3. Not everything changed — and an important caveat
The dominant cost, __memset_avx2_unaligned_erms (~13% self time, from protocol/loop __init__), is essentially flat (390 µs → 387 µs), as are the pure-Python protocol callbacks buffer_updated and get_buffer. So the source changes explain the improvement in the write path specifically, not a wholesale speedup.
transport, ssl_transport, and utils shared libraries have different build IDs. In Simulation mode the cache model is derived from the runner's CPU, so a different toolchain/runner can shift the estimate on identical source. This means some fraction of the reported +10.51% is attributable to that environment difference rather than your code, and the exact percentage should be read with that in mind.
Bottom line: the real, code-attributable win is the leaner transport struct (better cache locality in the sendfile path) plus slightly fewer event-loop iterations; the headline number is somewhat inflated by a cross-environment comparison.
Summary
- Warming up the performance wizard...
- Handling comment — Comment handling finished successfully
Was this response helpful? React with 👍 or 👎 to help us improve CodSpeedBot.
No description provided.