| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize() with the new public PyBytesWriter API.
|
Micro-benchmark: import pyperf
import socket
s1, s2 = socket.socketpair()
loops = 100
size = 1
def func():
s1.sendall(b'x' * (size * loops))
for _ in range(loops):
s = s2.recv(size)
if len(s) != size:
raise Exception
runner = pyperf.Runner()
runner.bench_func('bench', func, inner_loops=loops)
s1.close()
s2.close()Result:
|
Sorry, something went wrong.
|
Another micro-benchmark: import pyperf
import socket
s1, s2 = socket.socketpair()
def func(size):
s1.sendall(b'x' * size)
s = s2.recv(size)
if len(s) != size:
raise Exception
runner = pyperf.Runner()
for size in (1, 10, 100, 1000, 10_000, 100_000):
runner.bench_func(f'recv {size:,}B', func, size)
s1.close()
s2.close()Result:
Benchmark hidden because not significant (1): recv 100,000B The benchmark is not reliable :-( If I run it again, I get different result:
Benchmark hidden because not significant (3): recv 10B, recv 1,000B, recv 10,000B |
Sorry, something went wrong.
|
This introduced some refleaks. |
Sorry, something went wrong.
Ooops, thanks for the report! I wrote #139151 to fix it. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize() with the new public PyBytesWriter API.