Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jan 7, 2026

@vstinner
Copy link
Member Author

vstinner commented Jan 7, 2026

Example:

import socket, time, select

s1, s2 = socket.socketpair()
poll = select.poll()
poll.register(s1, select.POLLIN)
ms = 1e-6
start_time = time.perf_counter()
poll.poll(ms)
dt = time.perf_counter() - start_time
print(f"dt: {dt*1e6:.1f} us")
s1.close()
s2.close()

Results on Linux:

  • Without this change: dt: 1099.4 us
  • With this change: dt: 61.7 us => 18x better resolution

@vstinner vstinner merged commit 3514ba2 into python:main Jan 15, 2026
46 checks passed
@vstinner vstinner deleted the ppoll branch January 15, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant