Changes by Sergey Fedoseev <fedoseev.ser...@gmail.com>:
--
pull_requests: +3025
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
New submission from Sergey Fedoseev:
> python -mtimeit -s "l = list(range(10))" "l[-1] in l"
1000 loops, best of 3: 1.34 msec per loop
> python -mtimeit -s "l = list(range(10))" "l[-1] in iter(l)"
>
Changes by Sergey Fedoseev <fedoseev.ser...@gmail.com>:
--
components: +Library (Lib)
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
New submission from Sergey Fedoseev:
Currently TestResult.addSubTest() is called just before TestResult.stopTest(),
but docs says that addSubTest is "Called when a subtest finishes". IMO that
means that it will be called immediately after subtest finishes, but not after
indefinite t
New submission from Sergey Fedoseev <fedoseev.ser...@gmail.com>:
Before:
$ ./python -m timeit -s "from binascii import unhexlify; b = b'aa'*2**20"
"unhexlify(b)"
50 loops, best of 5: 5.68 msec per loop
After:
$ ./python -m timeit -s "from binascii im
Change by Sergey Fedoseev <fedoseev.ser...@gmail.com>:
--
components: +Library (Lib)
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Change by Sergey Fedoseev <fedoseev.ser...@gmail.com>:
--
keywords: +patch
pull_requests: +4508
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Sergey Fedoseev <fedoseev.ser...@gmail.com> added the comment:
Serhiy, did you use the same benchmark as mentioned here?
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Sergey Fedoseev <fedoseev.ser...@gmail.com> added the comment:
> OS
x86_64 GNU/Linux
> compiler
gcc version 7.2.0 (Debian 7.2.0-16)
> CPU
Architecture:x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) lis
Sergey Fedoseev <fedoseev.ser...@gmail.com> added the comment:
Is there anything I can do to push this forward?
BTW, Serhiy, what are your OS, compiler and CPU?
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue8488>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue33576>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue21145>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +7651
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34018>
___
___
Py
New submission from Sergey Fedoseev :
SQLite converters are documented to be sensitive to the case of type names, but
they're not.
In [50]: import sqlite3
...:
...: sqlite3.converters.clear()
...: sqlite3.register_converter('T', lambda x: 'UPPER')
...: sqlite3
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8140
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue28940>
___
___
Py
New submission from Sergey Fedoseev :
pysqlite_build_row_cast_map() can crash on memory allocation failure:
1. it doesn't check that PyList_New() returns non-NULL
2. Py_DECREF() borrowed reference when
--
components: Extension Modules
messages: 322396
nosy: sir-sigurd
priority: normal
Change by Sergey Fedoseev :
--
pull_requests: +7996
___
Python tracker
<https://bugs.python.org/issue34230>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
pull_requests: +7998
___
Python tracker
<https://bugs.python.org/issue32788>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Sergey Fedoseev :
`PyTuple_SetItem()` can be replaced with macro version and `PyObject_Call()`
can be used instead of `PyEval_CallObject()`.
Here's benchmark results:
$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s
"from functools i
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8107
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34303>
___
___
Py
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8233
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34397>
___
___
Py
New submission from Sergey Fedoseev :
Max size of list and tuples is limited by PY_SSIZE_T_MAX / sizeof(PyObject*),
so the sum of any two list/tuples sizes always <= PY_SSIZE_T_MAX if
sizeof(PyObject*) > 1, which seems true for all supported (existing?) platforms.
It means that ov
Sergey Fedoseev added the comment:
> Could you elaborate a bit more on how/where the leak happens?
It happens when PyMem_Resize() fails. It was used like this:
Py_UCS4 *field = self->field;
self->field = PyMem_Resize(field, Py_UCS4, self->field_size);
The last statement chang
Change by Sergey Fedoseev :
--
pull_requests: +8258
___
Python tracker
<https://bugs.python.org/issue34395>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
pull_requests: +8262
___
Python tracker
<https://bugs.python.org/issue34395>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Sergey Fedoseev :
There are memory leaks in csv and pickle modules caused by incautious usage of
PyMem_Resize().
See GitHub PR.
--
components: Extension Modules
messages: 323487
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: memory leaks
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8232
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34395>
___
___
Py
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
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8374
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34488>
___
___
Py
Change by Sergey Fedoseev :
--
title: performance of some list slice assignment can be improved -> performance
of some list slice assignment margin cases can be improved
___
Python tracker
<https://bugs.python.org/issu
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +7870
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34152>
___
___
Py
New submission from Sergey Fedoseev :
Script for benchmarks:
NAME=list-slice.json
python -m perf timeit --name "l[len(l):] = reversed(l)" -l 1 -s "l = [None] *
100" "l[len(l):] = reversed(l)" --append $NAME
python -m perf timeit --name "l[len(l):] = l&
New submission from Sergey Fedoseev :
Currently list concatenation, slicing and repeating operations are using
PyList_New() which allocates memory for the items by calloc(). malloc() could
be used instead, since the allocated memory is overwritten by mentioned
operations.
I made benchmarks
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +7869
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34151>
___
___
Py
Sergey Fedoseev added the comment:
Other iterators either don't support pickling or aren't mutated during pickling:
In [10]: it = iter({1})
In [11]: pickle.dumps(it)
Out[11]:
b'\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00\x8c\x08builtins\x94\x8c\x04iter\x94\x93\x94]\x94K\x01a\x85\x94R\x94
New submission from Sergey Fedoseev :
Currently _Py_bytes_capitalize() checks case before using conversion table,
performance can be improved by using conversion table unconditionally.
Benchmarks:
$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s "b
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8541
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34599>
___
___
Py
Change by Sergey Fedoseev :
--
pull_requests: +8519
___
Python tracker
<https://bugs.python.org/issue1621>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +7702
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34052>
___
___
Py
New submission from Sergey Fedoseev :
In [1]: import sqlite3
In [2]: con = sqlite3.connect(':memory:')
In [3]: con.execute('SELECT f()')
---
OperationalError Traceback (most recent call last
New submission from Sergey Fedoseev :
SQLiter 3.8.3 and higher allows to mark created functions as deterministic to
allow additional optimizations. There isn't currently a way to it from Python.
https://sqlite.org/c3ref/create_function.html
--
components: Extension Modules
messages
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +7687
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34041>
___
___
Py
Sergey Fedoseev added the comment:
> Now you rely on PyMem_Malloc() to detect the overflow.
Now overflow is not possible or am I missing something?
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/iss
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue21165>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue23460>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue34995>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue28397>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue32788>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue34898>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Sergey Fedoseev :
Currently __reduce__() implementation of set and dict iterators saves items to
list using next/PyList_Append(), it could be simplified by using
PySequence_List().
--
components: Interpreter Core
messages: 324550
nosy: sir-sigurd
priority: normal
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8512
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34573>
___
___
Py
New submission from Sergey Fedoseev :
In [1]: from collections import OrderedDict
In [2]: od = OrderedDict.fromkeys(range(10))
In [3]: it = iter(od)
In [4]: it.__reduce__()
Out[4]: (, ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9],))
In [5]: list(it)
Out[5]: []
--
messages: 324551
nosy: sir
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8513
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34574>
___
___
Py
Change by Sergey Fedoseev :
--
nosy: +sir-sigurd
___
Python tracker
<https://bugs.python.org/issue34751>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Sergey Fedoseev :
I reworked implementation of binascii.a2b_base64() and there is significant
speedup:
$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s
"from binascii import b2a_base64, a2b_base64; s = b2a_base64(1000 * b'b')"
&qu
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +8859
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue34749>
___
___
Py
Change by Sergey Fedoseev :
--
pull_requests: +10490
___
Python tracker
<https://bugs.python.org/issue33234>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
pull_requests: +12062
___
Python tracker
<https://bugs.python.org/issue36030>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
pull_requests: +12078
___
Python tracker
<https://bugs.python.org/issue36030>
___
___
Python-bugs-list mailing list
Unsubscribe:
Sergey Fedoseev added the comment:
This optimization also can be used for BUILD_TUPLE opcode and in pickle module,
if it's OK to add _PyTuple_StealFromArray() function :-)
--
___
Python tracker
<https://bugs.python.org/issue36
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +11993
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36062>
___
_
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +11952
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36030>
___
_
New submission from Sergey Fedoseev :
There are several cases in CPython sources when PyList_AsTuple() is used with
just created list and immediately after that this list is Py_DECREFed. This
operation can be performed more effectively since refcount of items is not
changed. For example
New submission from Sergey Fedoseev :
PyTuple_New() fills items array with NULLs to make usage of Py_DECREF() safe
even when array is not fully filled with real items.
There are multiple cases when this initialization step can be avoided to
improve performance. For example it gives such speed
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +11953
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36031>
___
_
Sergey Fedoseev added the comment:
Does this look like more real world example?
Before:
$ python -m perf timeit -s "t = (1, 2, 3)" "(*t, 4, 5)"
.
Mean +- std dev: 95.7 ns +- 2.3 ns
After:
$ python -m perf timeit -s "t = (1, 2, 3)" "(*t
New submission from Sergey Fedoseev :
list_slice() is used by PyList_GetSlice(), list_subscript() and for list
copying. In list_subscript() slice indices are already normalized with
PySlice_AdjustIndices(), so slice normalization currently performed in
list_slice() is only needed
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +11998
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36063>
___
_
New submission from Sergey Fedoseev :
This change produces minor speed-up:
$ python-other -m perf timeit -s "divmod_ = divmod" "divmod_(1, 1)"
--duplicate=1000 --compare-to=../cpython-master/venv/bin/python
python: . 64.6 ns +-
Sergey Fedoseev added the comment:
Here's benchmarks for PyTuple_FromArray() PR:
$ python -m perf timeit -s "l = [None]*0; tuple_ = tuple" "tuple_(l)"
--duplicate=100 --compare-to=../cpython-master/venv/bin/python
/home/sergey/tmp/cpython-master/venv/bin/python: ..
Sergey Fedoseev added the comment:
> Can you please convert msg336142 into a perf script?
> And then run again these benchmarks on PR 12052.
++-+--+
| Benchmark | ref | unt
Sergey Fedoseev added the comment:
>> This optimization also can be used for BUILD_TUPLE opcode and in pickle
>> module, if it's OK to add _PyTuple_StealFromArray() function :-)
> I would like to see a micro-benchmark showing t
Change by Sergey Fedoseev :
Added file: https://bugs.python.org/file48173/build_tuple_bench.py
___
Python tracker
<https://bugs.python.org/issue36030>
___
___
Python-bug
Change by Sergey Fedoseev :
Added file: https://bugs.python.org/file48174/list_as_tuple_bench.py
___
Python tracker
<https://bugs.python.org/issue36030>
___
___
Pytho
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +12008
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36073>
___
_
New submission from Sergey Fedoseev :
It's somewhat similar to bpo-10811, but for converter function:
In [197]: import sqlite3 as sqlite
...: con = sqlite.connect(':memory:', detect_types=sqlite.PARSE_COLNAMES)
...: cur = con.cursor()
...: sqlite.converters['CURSOR_INIT
Sergey Fedoseev added the comment:
I added WIP PR with discussed micro-optimization, here are benchmark results:
$ python -m perf compare_to --min-speed 1 -G master.json tuple-untracked.json
Slower (1):
- sqlite_synth: 5.16 us +- 0.10 us -> 5.22 us +- 0.08 us: 1.01x slower (+1%)
Faster
New submission from Sergey Fedoseev :
In [186]: from itertools import cycle
In [187]: class ContainerLike:
...: def __init__(self):
...: self.chars = cycle('12')
...: def __getitem__(self, key):
...: return next(self.chars)
...:
In [188
Change by Sergey Fedoseev :
--
title: str.translate() behave differently for ASCII-only and other strings ->
str.translate() behaves differently for ASCII-only and other strings
___
Python tracker
<https://bugs.python.org/issu
Change by Sergey Fedoseev :
--
pull_requests: +11979
___
Python tracker
<https://bugs.python.org/issue36030>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Sergey Fedoseev :
--
pull_requests: +13420
___
Python tracker
<https://bugs.python.org/issue31862>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +14975
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15254
___
Python tracker
<https://bugs.python.org/issu
Sergey Fedoseev added the comment:
`BytesIO.write()` and `BytesIO.writelines()` are independent of each other.
--
___
Python tracker
<https://bugs.python.org/issue34
New submission from Sergey Fedoseev :
When compiled with default NSMALLPOSINTS, _PyLong_FromUnsignedChar() is
significantly faster than other PyLong_From*():
$ python -m perf timeit -s "from collections import deque; consume =
deque(maxlen=0).extend; b = bytes(2**20)" "consume
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +14971
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15251
___
Python tracker
<https://bugs.python.org/issu
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +14972
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15250
___
Python tracker
<https://bugs.python.org/issu
New submission from Sergey Fedoseev :
bytearray_getitem() adjusts negative index, though that's already done by
PySequence_GetItem().
This makes PySequence_GetItem(bytearray(1), -2) to return 0 instead of raise
IndexError.
--
components: Interpreter Core
messages: 349545
nosy: sir
Change by Sergey Fedoseev :
--
pull_requests: +15095
pull_request: https://github.com/python/cpython/pull/15386
___
Python tracker
<https://bugs.python.org/issue27
Change by Sergey Fedoseev :
--
pull_requests: +15098
pull_request: https://github.com/python/cpython/pull/15388
___
Python tracker
<https://bugs.python.org/issue27
Change by Sergey Fedoseev :
--
pull_requests: +15094
pull_request: https://github.com/python/cpython/pull/15385
___
Python tracker
<https://bugs.python.org/issue27
Sergey Fedoseev added the comment:
$ gcc -v 2>&1 | grep 'gcc version'
gcc version 8.3.0 (Debian 8.3.0-19)
using ./configure --enable-optimizations --with-lto
$ python -m perf timeit -s "from collections import deque; consume =
deque(maxlen=0).extend; b = bytes(2**20)" "
New submission from Sergey Fedoseev :
PyLong_As*() functions have a lot of duplicated code, creating draft PR with
attempt to deduplicate them.
--
components: Interpreter Core
messages: 350367
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: refactor PyLong_As
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +15152
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15457
___
Python tracker
<https://bugs.python.org/issu
Sergey Fedoseev added the comment:
Previous benchmarks results were obtained with non-LTO build.
Here are results for LTO build:
$ python -m perf timeit -s "from itertools import repeat; _len = repeat(None,
0).__length_hint__" "_len()" --compare-to=../cpython-ma
Sergey Fedoseev added the comment:
These last results are invalid :-)
I thought that I was checking _PyLong_FromUnsignedChar() on top of GH-15192,
but that wasn't true. So the correct results for LTO build are:
$ python -m perf timeit -s "from collections import deque; consume =
New submission from Sergey Fedoseev :
This patch simplifies fast path for floats that fit into C long and moves it
from float.__trunc__ to PyLong_FromDouble().
+-+-+--+
| Benchmark | long-from-float-ref | long-from
Change by Sergey Fedoseev :
--
keywords: +patch
pull_requests: +15268
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15592
___
Python tracker
<https://bugs.python.org/issu
Sergey Fedoseev added the comment:
Maybe it's not clear from description, but traceback only show the line with
zip(), so it doesn't help at localizing the source of exception at all.
You only see that 'argument #N must support iteration', but that argument has
__iter__() i.e. it supports
1 - 100 of 136 matches
Mail list logo