[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-08-06 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-08-06 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 3e41f3cabb661824a1a197116f7f5ead64eb6ced by Inada Naoki (Sergey 
Fedoseev) in branch 'master':
bpo-34488: optimize BytesIO.writelines() (GH-8904)
https://github.com/python/cpython/commit/3e41f3cabb661824a1a197116f7f5ead64eb6ced


--

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-08-05 Thread Inada Naoki


Change by Inada Naoki :


--
components: +IO -Extension Modules
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-08-02 Thread Sergey Fedoseev


Sergey Fedoseev  added the comment:

`BytesIO.write()` and `BytesIO.writelines()` are independent of each other.

--

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-04-08 Thread Inada Naoki


Inada Naoki  added the comment:

Hm, what happened if subclass of BytesIO overrides `write` but not `writelines`?

--
nosy: +inada.naoki

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2018-08-24 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
keywords: +patch
pull_requests: +8374
stage:  -> patch review

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2018-08-24 Thread Sergey Fedoseev


New submission from Sergey Fedoseev :

Currently BytesIO.writelines() uses BytesIO.write() which returns number of 
written bytes as Python ints, but these ints are not used by 
BytesIO.writelines(), so avoiding creation of these ints can improve 
performance of BytesIO.writelines() especially for a large number of small 
lines.

Benchmarks:

python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from io import BytesIO; lines = [b'']*1;" "BytesIO().writelines(lines)"
  
/home/sergey/tmp/cpython-master-venv/bin/python: . 153 us 
+- 3 us
/home/sergey/tmp/cpython-venv/bin/python: . 126 us +- 4 us

Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 153 us +- 3 
us -> [/home/sergey/tmp/cpython-venv/bin/python] 126 us +- 4 us: 1.22x faster 
(-18%)

python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from io import BytesIO; lines = [b'b']*1;" "BytesIO().writelines(lines)"
/home/sergey/tmp/cpython-master-venv/bin/python: . 164 us 
+- 2 us
/home/sergey/tmp/cpython-venv/bin/python: . 142 us +- 1 us

Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 164 us +- 2 
us -> [/home/sergey/tmp/cpython-venv/bin/python] 142 us +- 1 us: 1.16x faster 
(-13%)

python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from io import BytesIO; lines = [b'b'*10]*1;" "BytesIO().writelines(lines)"
/home/sergey/tmp/cpython-master-venv/bin/python: . 387 us 
+- 6 us
/home/sergey/tmp/cpython-venv/bin/python: . 365 us +- 8 us

Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 387 us +- 6 
us -> [/home/sergey/tmp/cpython-venv/bin/python] 365 us +- 8 us: 1.06x faster 
(-5%)

python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from io import BytesIO; lines = [b'b'*100]*1;" 
"BytesIO().writelines(lines)"   
 
/home/sergey/tmp/cpython-master-venv/bin/python: . 319 us 
+- 5 us
/home/sergey/tmp/cpython-venv/bin/python: . 305 us +- 16 us

Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 319 us +- 5 
us -> [/home/sergey/tmp/cpython-venv/bin/python] 305 us +- 16 us: 1.04x faster 
(-4%)

python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from io import BytesIO; lines = [b'b'*1000]*1;" 
"BytesIO().writelines(lines)"
/home/sergey/tmp/cpython-master-venv/bin/python: . 1.13 ms 
+- 0.02 ms
/home/sergey/tmp/cpython-venv/bin/python: . 988 us +- 88 us

Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 1.13 ms +- 
0.02 ms -> [/home/sergey/tmp/cpython-venv/bin/python] 988 us +- 88 us: 1.14x 
faster (-12%)

python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from io import BytesIO; lines = [b'b'*1]*1;" 
"BytesIO().writelines(lines)"
/home/sergey/tmp/cpython-master-venv/bin/python: . 38.7 ms 
+- 0.1 ms
/home/sergey/tmp/cpython-venv/bin/python: . 38.2 ms +- 0.1 
ms

Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 38.7 ms +- 
0.1 ms -> [/home/sergey/tmp/cpython-venv/bin/python] 38.2 ms +- 0.1 ms: 1.01x 
faster (-1%)

--
components: Extension Modules
messages: 324011
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: improve performance of BytesIO.writelines() by avoiding creation of 
unused PyLongs
type: performance
versions: Python 3.8

___
Python tracker 

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