[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-14 Thread INADA Naoki
INADA Naoki added the comment: Traceback tells: #22 0x005a52db in PyInterpreterState_Clear (interp=0x95ac80) at ../Python/pystate.c:111 Py_CLEAR(interp->sysdict); While cleaning up interp->sysdict... #19 0x004d86c6 in tb_dealloc.46270 (tb=0x7f0aa1278f38) at ../

[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread INADA Naoki
INADA Naoki added the comment: > I don't understand well the effect of the hot attribute I compared lookdict_unicode_nodummy assembly by `objdump -d dictobject.o`. It looks completely same. So I think only difference is placement. hot functions are in .text.hot section and linker gr

[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread INADA Naoki
INADA Naoki added the comment: > so I suggest to run benchmarks and check that it has a non negligible effect > on benchmarks ;-) When added _Py_HOT_FUNCTION to lookdict_unicode, lookdict_unicode_nodummy and lookdict_split (I can't measure L1 miss via `perf stat -d` because I

[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-15 Thread INADA Naoki
INADA Naoki added the comment: Can you check backtrace of main thread? -- ___ Python tracker <http://bugs.python.org/issue28673> ___ ___ Python-bugs-list mailin

[issue28701] Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString

2016-11-15 Thread INADA Naoki
INADA Naoki added the comment: Patch LGTM. But I don't know it's OK to commit it on 2.7, 3.5 and 3.6. -- nosy: +inada.naoki ___ Python tracker <http://bugs.python.o

[issue27945] Various segfaults with dict

2016-11-16 Thread INADA Naoki
INADA Naoki added the comment: 0001-Issue-27945-fix-PyDict_MergeFromSeq2-use-after-free.patch: LGTM. I've checked it can be applied to 2.7 and 3.5 branch and passes `make quicktest`. -- ___ Python tracker <http://bugs.python.org/is

[issue27945] Various segfaults with dict

2016-11-16 Thread INADA Naoki
INADA Naoki added the comment: 0001-Issue-27945-fix-dictitems_contains-use-after-free.patch LGTM. This patch can be applied to 2.7 and 3.5, without conflict against previous patch. It passes `make quicktest`. -- ___ Python tracker <h

[issue27945] Various segfaults with dict

2016-11-16 Thread INADA Naoki
INADA Naoki added the comment: 0001-Issue-27945-fix-dictiter_iternextitem-use-after-free.patch LGTM and OK too. But 0001-Issue-27945-Fixed-segfaults-in-dict.fromkeys-when-it.patch cause conflict. I want to commit first three patches. For another reviewer, here is the patch merging three

[issue27945] Various segfaults with dict

2016-11-16 Thread INADA Naoki
INADA Naoki added the comment: OK, I'll run benchmark in this week. But three patches seems don't affects to performance critical APIs. -- ___ Python tracker <http://bugs.python.o

[issue27945] Various segfaults with dict

2016-11-17 Thread INADA Naoki
INADA Naoki added the comment: I run performance 0.5.0 on Python 3.5. Since it took long time even without -b all option, I haven't run it for Python 2.7 yet. On Python 3.5: $ ./venv/cpython3.5-846d5b1f0b61/bin/python -m perf compare_to py35-master.json py35-patched.json -G Slowe

[issue27945] Various segfaults with dict

2016-11-17 Thread INADA Naoki
INADA Naoki added the comment: Only patch which affects to hot loop is: --- a/Objects/dictobject.c Tue Nov 15 21:21:35 2016 -0500 +++ b/Objects/dictobject.c Wed Nov 16 11:40:51 2016 + @@ -1550,11 +1550,18 @@ PyDict_MergeFromSeq2(PyObject *d, PyObje /* Update/merge with

[issue27945] Various segfaults with dict

2016-11-17 Thread INADA Naoki
INADA Naoki added the comment: I'm sorry, dict.fromkeys() didn't use PyDict_MergeFromSeq2(). This may be microbench for worst case: $ ~/local/py35/bin/master -m perf timeit --rigorous --python ~/local/py35/bin/patched --compare-to ~/local/py35/bin/master -s 'L = [(i,i) for i

[issue27945] Various segfaults with dict

2016-11-17 Thread INADA Naoki
INADA Naoki added the comment: I modified the patch to avoid incref&decref when pair is not list, because tuple is common for such case. But I can't get back original performance. (python 2.7 is modified version of patch) inada-n@test1:~/work/bench$ ~/local/py27/bin/master -m pe

[issue28724] Add method send_io, recv_io to the socket module.

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: FYI, multiprocessing.reduction module has send_fds and recv_fds. -- nosy: +inada.naoki ___ Python tracker <http://bugs.python.org/issue28

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
New submission from INADA Naoki: _PyDict_NewPresized(6) creates dict which keysize is 8. But it's capacity is 5 (8 * 2 // 3 = 5). This internal API is used by BUILD_MAP and BUILD_CONST_KEYMAP. -- assignee: inada.naoki files: PyDict_NewPresized-too-small.patch keywords: patch mes

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: This patch includes fix for ESTIMATE_SIZE macro. (see below) Same fix is included in patch for issue28147. >>> def estimate_size(n): ... return n * 3 // 2 # Current ESTIMATE_SIZE ... >>> def usable(n): ... return n * 2 // 3 ... >&

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: current: $ ~/work/python36/bin/python3 -m perf timeit -- 'd = {"a":1, "b":2, "c":3, "d":4, "e":5, "f":6}' . Median +- std dev: 925 ns +- 49 ns patched: $ ~/work/python36/

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: inada-n@test1:~/work/py36$ ~/local/py36/bin/patched -m perf timeit --compare-to ~/local/py36/bin/master -- 'd = {"a":1, "b":2, "c":3, "d":4, "e":5, "f":6}' master: . 910 ns

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: Python 3.5 has similar issue: $ ~/local/py35/bin/patched -m perf timeit --compare-to ~/local/py35/bin/master -- 'd = {"a":1, "b":2, "c":3, "d":4, "e":5, "f":6}' master: . 1.1

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: On Fri, Nov 18, 2016 at 9:31 PM, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > The condition in the loop in _PyDict_NewPresized() contains the test newsize > > 0. This is a check for integer overflow. But it doesn't ma

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: Can I assume PY_SSIZE_T_MAX is 2**n-1? If so, I can define like: #define PyDict_MAXSIZE (PY_SSIZE_T/8+1) -- ___ Python tracker <http://bugs.python.org/issue28

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-18 Thread INADA Naoki
INADA Naoki added the comment: > This optimization affects only 6-element (and perhaps to less extend > 11-element) dicts. But in any case this is good enhancement. This affects when minused = (n*2/3)+1 .. n-1 (n=8, 16, ...) n=8: 6, 7 n=16: 11, 12, ..15 > Naoki, could you pl

[issue27945] Various segfaults with dict

2016-11-20 Thread INADA Naoki
INADA Naoki added the comment: LGTM. Performance on Azure VM (AMD Opteron(tm) Processor 4171 HE): $ ~/local/py36/bin/patched -m perf compare_to master.json patched.json -G Slower (10): - spectral_norm: 915 ms +- 17 ms -> 967 ms +- 25 ms: 1.06x slower - nbody: 774 ms +- 28 ms -> 805 ms +-

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: > If someone comes forward with more fully formed idea for code generation or > overall structural enchancement, that can be put in another tracker item. I noticed argument clinic supports Python [1]. So there is one way to code generation already. At

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: Updated patch: fixed small issue in argument clinic, and added comment why we use code generation. -- Added file: http://bugs.python.org/file45580/namedtuple-clinic2.diff ___ Python tracker <http://bugs.python.

[issue28532] Show sys.version when -V option is supplied twice.

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: I noticed today is code freeze for final beta. Is this too late for 3.6.0? -- priority: normal -> high ___ Python tracker <http://bugs.python.org/issu

[issue28023] python-gdb.py must be updated for the new Python 3.6 compact dict

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: ping -- ___ Python tracker <http://bugs.python.org/issue28023> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-21 Thread INADA Naoki
Changes by INADA Naoki : Added file: http://bugs.python.org/file45583/28731-PyDict_NewPresized-too-small-2.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28532] Show sys.version when -V option is supplied twice.

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: Thanks for review. Since doc update is allowed after final beta, I committed verbose-version3.patch for now. Here is patch for doc. -- Added file: http://bugs.python.org/file45585/vervose-version-doc.patch ___ Python

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-21 Thread INADA Naoki
Changes by INADA Naoki : Added file: http://bugs.python.org/file45586/28731-PyDict_NewPresized-too-small-3.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: OK. I've updated the patch. BTW, I used const Py_ssize_t for function local constant. Should I use file scope macro for such heuristic threshold, even it is used only one function? -- priority: high ->

[issue28023] python-gdb.py must be updated for the new Python 3.6 compact dict

2016-11-21 Thread INADA Naoki
Changes by INADA Naoki : Added file: http://bugs.python.org/file45589/dict_gdb2.patch ___ Python tracker <http://bugs.python.org/issue28023> ___ ___ Python-bugs-list m

[issue28731] _PyDict_NewPresized() creates too small dict

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: Thanks. As @haypo suggests, I'll commit this to default branch first, and backport to 3.6 after 3.6.0 is released. -- ___ Python tracker <http://bugs.python.org/is

[issue28635] Update What's New for 3.6

2016-11-21 Thread INADA Naoki
INADA Naoki added the comment: I added ``-VV`` option to python command (issue28532). Which section should I add the entry about it? -- nosy: +inada.naoki ___ Python tracker <http://bugs.python.org/issue28

[issue28023] python-gdb.py must be updated for the new Python 3.6 compact dict

2016-11-22 Thread INADA Naoki
INADA Naoki added the comment: https://mail.python.org/pipermail/python-committers/2016-November/004065.html > The 3.6 branch in the cpython repo is now available again but, as noted, > *only* for reviewed release critical fixes appropriate for the 3.6.0 final > and for final 3.6.0 do

[issue28023] python-gdb.py must be updated for the new Python 3.6 compact dict

2016-11-22 Thread INADA Naoki
Changes by INADA Naoki : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker <http://bugs.python.or

[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-22 Thread INADA Naoki
INADA Naoki added the comment: Wow. It's sad that tagged version is accidentally slow... I want to reproduce it and check `perf record -e L1-icache-load-misses`. But IaaS (EC2, GCE, Azure VM) doesn't support CPU performance counter. --

[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-22 Thread INADA Naoki
INADA Naoki added the comment: I setup Ubuntu 14.04 on Azure, built python without neither PGO nor LTO. But I failed to reproduce it. @haypo, would you give me two binaries? $ ~/local/py-2a143/bin/python3 -c 'import sys; print(sys.version)' 3.7.0a0 (default:2a14385710dc, Nov 22 2016

[issue28023] python-gdb.py must be updated for the new Python 3.6 compact dict

2016-11-22 Thread INADA Naoki
INADA Naoki added the comment: Thanks a lot! I hope I can run test on multiple environment before merge, after we move to Github. -- ___ Python tracker <http://bugs.python.org/issue28

<    26   27   28   29   30   31