| 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.
|
I ran a microbenchmark on os.read(): import pyperf
import os
file = open(__file__, "rb", 0)
fd = file.fileno()
def func():
os.lseek(fd, 0, os.SEEK_SET)
for _ in range(100):
os.read(fd, 1)
runner = pyperf.Runner()
runner.bench_func('bench', func)
file.close()Result: Mean +- std dev: [ref] 34.0 us +- 0.3 us -> [pep782] 33.6 us +- 0.3 us: 1.01x faster So this change has no significant impact on the performance. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize() with the new public PyBytesWriter API.