[issue37842] Initialize Py_buffer variables more efficiently

2019-08-13 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
keywords: +patch
pull_requests: +14975
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15254

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37842] Initialize Py_buffer variables more efficiently

2019-08-13 Thread Sergey Fedoseev


New submission from Sergey Fedoseev :

Argument Clinic generates `{NULL, NULL}` initializer for Py_buffer variables. 
Such initializer zeroes all Py_buffer members, but as I understand only `obj` 
and `buf` members are really had to be initialized. Avoiding unneeded 
initialization provides tiny speed-up:

$ python -m perf timeit -s "replace = b''.replace" "replace(b'', b'')" 
--compare-to=../cpython-master/venv/bin/python --duplicate=1000
/home/sergey/tmp/cpython-master/venv/bin/python: . 43.0 ns 
+- 0.5 ns
/home/sergey/tmp/cpython-dev/venv/bin/python: . 41.8 ns +- 
0.4 ns

Mean +- std dev: [/home/sergey/tmp/cpython-master/venv/bin/python] 43.0 ns +- 
0.5 ns -> [/home/sergey/tmp/cpython-dev/venv/bin/python] 41.8 ns +- 0.4 ns: 
1.03x faster (-3%)

--
components: Argument Clinic
messages: 349582
nosy: larry, sir-sigurd
priority: normal
severity: normal
status: open
title: Initialize Py_buffer variables more efficiently
type: performance
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com