[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki
Inada Naoki added the comment: You are right. I misunderstood. ``` if (PyUnicode_IS_ASCII(text) && (PyUnicode_GET_LENGTH(text) + (self->pending_bytes ? self->pending_bytes_count : 0)) <=

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki
Inada Naoki added the comment: In your code, huge data passed to .write(huge) may be remained in the internal buffer. ``` [NEW PRE-FLUSH] else if ((self->pending_bytes_count + bytes_len) > self->chunk_size) { if (_textiowrapper_writeflush(self) < 0) {

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +23372 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24592 ___ Python tracker <https://bugs.python.org/issu

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki
Inada Naoki added the comment: This is not the problem only in the optimization. _textiowrapper_writeflush need to create buffer bytes object anyway and if it cause MemoryError, the TextIOWrapper can not flush internal buffer forever. stdout.write("small text") stdout.write(&

[issue43246] Dict copy optimization violates subclass invariant

2021-02-18 Thread Inada Naoki
Inada Naoki added the comment: I am not sure this should be fixed. If so, I think we should use PyDict_CheckExact() instead of PyDict_Check() && (tp_iter is overridden || keys() is overridden || sq_item is overridden). -- nosy: +rh

[issue43246] Dict copy optimization violates subclass invariant

2021-02-17 Thread Inada Naoki
Change by Inada Naoki : -- nosy: +methane ___ Python tracker <https://bugs.python.org/issue43246> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43214] site: Potential UnicodeDecodeError when handling pth file

2021-02-13 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +easy ___ Python tracker <https://bugs.python.org/issue43214> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43214] site: Potential UnicodeDecodeError when handling pth file

2021-02-13 Thread Inada Naoki
New submission from Inada Naoki : https://github.com/python/cpython/blob/4230bd52e3f9f289f02e41ab17a95f50ed4db5a6/Lib/site.py#L160 ``` f = io.TextIOWrapper(io.open_code(fullname)) ``` When default text encoding is not UTF-8 and pth file contains non-ASCII character, it will raise

[issue43174] Windows: Use /utf-8 compiler flag

2021-02-11 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.9 ___ Python tracker <https://bugs.python.or

[issue43174] Windows: Use /utf-8 compiler flag

2021-02-11 Thread Inada Naoki
Inada Naoki added the comment: New changeset 68d6bc798b34eccabdfbf94e563273759c4cef1f by Miss Islington (bot) in branch '3.9': bpo-43174: Windows: Use /utf-8 compiler option. (GH-24498) https://github.com/python/cpython/commit/68d6bc798b34eccabdfbf94e563273

[issue43174] Windows: Use /utf-8 compiler flag

2021-02-11 Thread Inada Naoki
Inada Naoki added the comment: May I backport this for Python 3.9? -- ___ Python tracker <https://bugs.python.org/issue43174> ___ ___ Python-bugs-list mailin

[issue43174] Windows: Use /utf-8 compiler flag

2021-02-11 Thread Inada Naoki
Inada Naoki added the comment: New changeset fedd86df2448370cdf62a229fd6f31dc92daf379 by Inada Naoki in branch 'master': bpo-43174: Windows: Use /utf-8 compiler option. (GH-24498) https://github.com/python/cpython/commit/fedd86df2448370cdf62a229fd6f31

[issue43188] multiple operations of dict causes core dump of Python interpreter.

2021-02-10 Thread Inada Naoki
Inada Naoki added the comment: Is this the crash you are reporting? ``` Exception ignored in: .Mutating.__del__ at 0x100d35af0> Traceback (most recent call last): File "/Users/methane/work/python/cpython/PC/xxx.py", line 5, in __del__ mutate(d) TypeError: 'str'

[issue43174] Windows: Use /utf-8 compiler flag

2021-02-09 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +23287 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24498 ___ Python tracker <https://bugs.python.org/issu

[issue42217] compiler: merge co_code and co_lnotab

2021-02-09 Thread Inada Naoki
Inada Naoki added the comment: New changeset bdb941be423bde8b02a5695ccf51c303d6204bed by Inada Naoki in branch 'master': bpo-42217: compiler: merge same co_code and co_linetable objects (GH-23056) https://github.com/python/cpython/commit/bdb941be423bde8b02a5695ccf51c3

[issue42217] compiler: merge co_code and co_lnotab

2021-02-09 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43174] Windows: Use /utf-8 compiler flag

2021-02-08 Thread Inada Naoki
New submission from Inada Naoki : When building Python on Windows Japanese environment, several warnings are shown. ``` C:\Users\songo\source\repos\cpython\Modules\_sha3\kcp\KeccakSponge.h(1,1): warning C4819: ファイルは、現在のコード ページ (932) で表示できない文字を含んでいます。データの損失を防ぐために、ファイルを Unicode 形式で保存してください。 [C

[issue35295] Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred

2021-02-04 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue35295] Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred

2021-02-04 Thread Inada Naoki
Inada Naoki added the comment: New changeset d938816acf71a74f1bd13fdf0534b3d9ea962e44 by Inada Naoki in branch 'master': bpo-35295: Remove outdated comment. (GH-24453) https://github.com/python/cpython/commit/d938816acf71a74f1bd13fdf0534b3

[issue35295] Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred

2021-02-04 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +23253 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24453 ___ Python tracker <https://bugs.python.org/issu

[issue35295] Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred

2021-02-04 Thread Inada Naoki
Change by Inada Naoki : -- versions: +Python 3.10 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue35295> ___ ___ Python-bugs-list mailing list Unsub

[issue35295] Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred

2021-02-04 Thread Inada Naoki
Inada Naoki added the comment: > 1a. Declare both functions equally acceptable. Remove comments claiming that > PyUnicode_AsUTF8AndSize() should be avoided. > > 1b. 1a, and change the implementation of PyUnicode_AsUTF8AndSize() to avoid > allocating the string twice if

[issue24275] lookdict_* give up too soon

2021-01-31 Thread Inada Naoki
Change by Inada Naoki : -- nosy: +methane ___ Python tracker <https://bugs.python.org/issue24275> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43030] signed/unsigned mismatch in Py_UNICODE_ISSPACE macro

2021-01-26 Thread Inada Naoki
Inada Naoki added the comment: Just replacing "128U" with "128" enough? Will `ch < 128` emit warning on platforms wchar_t is unsigned? -- ___ Python tracker <https://

[issue29708] support reproducible Python builds

2020-12-31 Thread Inada Naoki
Change by Inada Naoki : -- dependencies: +Reproducible pyc: FLAG_REF is not stable. ___ Python tracker <https://bugs.python.org/issue29708> ___ ___ Python-bug

[issue29708] support reproducible Python builds

2020-12-31 Thread Inada Naoki
Inada Naoki added the comment: > note the optimized .pyc is deterministic. As far as I know only __debug__ is > set to False, or is there something else different? There is no difference between normal pyc and optimized pyc. * frozenset is deterministic if PYTHONHASHSEED is set * FL

[issue29708] support reproducible Python builds

2020-12-30 Thread Inada Naoki
Inada Naoki added the comment: See bpo-34093 too. -- ___ Python tracker <https://bugs.python.org/issue29708> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-22 Thread Inada Naoki
Inada Naoki added the comment: > Okay, and also when GetConsoleCP() fails because there's no console (e.g. > python.exe w/ DETACHED_PROCESS creation flag, or pythonw.exe). When there is no console, stdio should use the default textio encoding that is ANSI for now. > Howeve

[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-22 Thread Inada Naoki
Inada Naoki added the comment: I think using Console codepage for stdio is better. But I am afraid about breaking existing code. How about treating only UTF-8 and leave legacy environment as-is? * When GetConsoleCP() returns CP_UTF8, use UTF-8 for stdin. Otherwise, use ANSI. * When

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2020-12-21 Thread Inada Naoki
Change by Inada Naoki : -- nosy: +methane ___ Python tracker <https://bugs.python.org/issue42246> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2020-12-15 Thread Inada Naoki
Inada Naoki added the comment: $ ./python -m pyperf compare_to master.json load_method.json -G --min-speed=1 Slower (15): - unpack_sequence: 63.2 ns +- 0.8 ns -> 68.5 ns +- 14.8 ns: 1.08x slower (+8%) - pathlib: 23.1 ms +- 0.3 ms -> 24.4 ms +- 0.4 ms: 1.05x slower (+5%) - scimark_fft:

[issue31904] Python should support VxWorks RTOS

2020-12-15 Thread Inada Naoki
Change by Inada Naoki : -- nosy: -methane ___ Python tracker <https://bugs.python.org/issue31904> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2020-12-14 Thread Inada Naoki
Inada Naoki added the comment: pidigits and regex_v8 are LOAD_ATTR heavy benchmarks? I will run benchmarks in my machine to confirm the results. -- ___ Python tracker <https://bugs.python.org/issue42

[issue42578] Add tip when encountering UnicodeDecode/EncodeError in open()

2020-12-07 Thread Inada Naoki
Inada Naoki added the comment: How do you think about PEP-597? https://www.python.org/dev/peps/pep-0597/ -- nosy: +methane ___ Python tracker <https://bugs.python.org/issue42

[issue42525] Optimize class/module level annotation

2020-12-01 Thread Inada Naoki
Inada Naoki added the comment: I agree with Batuhan. Although bytecode for class annotations seems inefficient, it is difficult to optimize without breaking backward compatibility. You can write arbitrary code in class/module block which dynamically manipulate __annotations__. ``` class

[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-26 Thread Inada Naoki
Inada Naoki added the comment: New changeset c8aaf71dde464c0c351e2f935f87652c3d54 by Volker-Weissmann in branch 'master': bpo-17852: Doc: Fix the tutorial about closing files (GH-23135) https://github.com/python/cpython/commit/c8aaf71dde464c0c351e2f935f87652c3d54 -

[issue41103] Removing old buffer support

2020-11-25 Thread Inada Naoki
Inada Naoki added the comment: Thank you for reporting. I removed these APIs to get such feedback as early as possible. We are free to revive these APIs if it breaks too much and some projects can not be fixed before Python 3.10 release. Some project maintainers ignore deprecations and

[issue42202] Optimize function annotation

2020-11-25 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue42202] Optimize function annotation

2020-11-25 Thread Inada Naoki
Inada Naoki added the comment: New changeset 7301979b23406220510dd2c7934a21b41b647119 by Yurii Karabas in branch 'master': bpo-42202: Store func annotations as a tuple (GH-23316) https://github.com/python/cpython/commit/7301979b23406220510dd2c7934a21

[issue36906] Compile time textwrap.dedent() equivalent for str or bytes literals

2020-11-22 Thread Inada Naoki
Inada Naoki added the comment: > I don't think we need two algorithms here. I'm +1 to add str.dedent() which > mirroring only inspect.cleandoc(). I withdraw this. If we add str.dedent(), it must not be optimized for triple-quote literal. Auto dedenting is very nice to

[issue36906] Compile time textwrap.dedent() equivalent for str or bytes literals

2020-11-21 Thread Inada Naoki
Inada Naoki added the comment: > (1) add a .dedent() method to str (and bytes?) - behaviors to consider > mirroring are textwrap.dedent() and inspect.cleandoc(). Given their utility > and similarities, it makes sense to offer both behaviors; behavior could be > selected by a

[issue42202] Optimize function annotation

2020-11-18 Thread Inada Naoki
Change by Inada Naoki : -- nosy: +lukasz.langa ___ Python tracker <https://bugs.python.org/issue42202> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42202] Optimize function annotation

2020-11-17 Thread Inada Naoki
Inada Naoki added the comment: I don't like co_annotations. * It changes PyCode_NewXXX() API. * Many functions don't have annotations. Adding annotation to code object makes code object fatter even if the function doesn't have annotation. * Code object is immutable &am

[issue42202] Optimize function annotation

2020-11-16 Thread Inada Naoki
Inada Naoki added the comment: > Yes, but the code for creating a dict can be simpler. In any case we will > better see what format is better when try to write a code. Note that many annotations are not accessed. RAM usage of annotation information is important than how easy to creat

[issue24886] open fails randomly on AIX

2020-11-13 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue24886> ___ ___

[issue42141] Speedup various dict inits

2020-11-12 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> rejected ___ Python tracker <https://bugs.python.org/issue42141> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue42179] Clarify chaining exceptions in tutorial/errors.rst

2020-11-08 Thread Inada Naoki
Inada Naoki added the comment: >> 1. Such understanding of a tutorial is debatable. Tutorial is just a >> material for learning written with some system in mind, which is more >> interesting to read than dry reference material. A tutorial, generally >> dpeaking, may b

[issue11346] Generator object should be mentioned in gc module document

2020-11-06 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue42179] Clarify chaining exceptions in tutorial/errors.rst

2020-11-05 Thread Inada Naoki
Inada Naoki added the comment: New changeset bde33e428d5b5f88ec7667598fd27d1091840537 by Inada Naoki in branch 'master': bpo-42179: Doc/tutorial: Remove mention of __cause__ (GH-23162) https://github.com/python/cpython/commit/bde33e428d5b5f88ec7667598fd27d

[issue42179] Clarify chaining exceptions in tutorial/errors.rst

2020-11-05 Thread Inada Naoki
Change by Inada Naoki : -- pull_requests: +22074 pull_request: https://github.com/python/cpython/pull/23162 ___ Python tracker <https://bugs.python.org/issue42

[issue37826] Document PEP 3134 in tutorials/errors.rst

2020-11-05 Thread Inada Naoki
Change by Inada Naoki : -- nosy: +methane nosy_count: 4.0 -> 5.0 pull_requests: +22073 pull_request: https://github.com/python/cpython/pull/23162 ___ Python tracker <https://bugs.python.org/issu

[issue42179] Clarify chaining exceptions in tutorial/errors.rst

2020-11-05 Thread Inada Naoki
Inada Naoki added the comment: > 1. Such understanding of a tutorial is debatable. Tutorial is just a material > for learning written with some system in mind, which is more interesting to > read than dry reference material. A tutorial, generally dpeaking, may be both > for begin

[issue42179] Clarify chaining exceptions in tutorial/errors.rst

2020-11-04 Thread Inada Naoki
Inada Naoki added the comment: Please note that tutorial is a tutorial. It is document to help new user who are learning Python. Do you believe special attributes like __cause__ and __contexts__ are really worth to teach for tutorial readers? Generally speaking, I think we should *reduce

[issue42049] Add image/webp to list of media types in mimetypes.py

2020-11-03 Thread Inada Naoki
Change by Inada Naoki : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42049> ___ ___ Pyth

[issue42205] Add image/webp to list of non-standard mimetypes

2020-11-03 Thread Inada Naoki
Change by Inada Naoki : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42205> ___ ___ Pyth

[issue38902] image/webp support in mimetypes

2020-11-03 Thread Inada Naoki
Inada Naoki added the comment: I'm +1 to add it in common types, because webp is really de-facto standard. https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types If no objection, I will merge this in next week. -- nosy: +methane versions: +Python 3.10 -Pytho

[issue42205] Add image/webp to list of non-standard mimetypes

2020-11-03 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> duplicate superseder: -> image/webp support in mimetypes ___ Python tracker <https://bugs.python.org/i

[issue42049] Add image/webp to list of media types in mimetypes.py

2020-11-03 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> duplicate superseder: -> image/webp support in mimetypes ___ Python tracker <https://bugs.python.org/i

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: I don't think UTF-8 mode should override os.device_encoding() on Windows. UTF-8 mode can be used to ignore legacy locale encoding, and os.device_encoding() uses the locale encoding on Unix. So overriding it make sense. But locale encoding and console c

[issue41835] Speed up dict vectorcall creation using keywords

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: While this is an interesting optimization, the gain is not enough. I close this issue for now. @Marco Sulla Optimizing dict is a bit hard job. If you want to continue, I have an idea: `dict(zip(keys, row))` is common use case. It is used by asdict() in datacalss

[issue41835] Speed up dict vectorcall creation using keywords

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: And bench_kwcall.py is a microbenchmark for _PyEval_EvalCode. $ cpython/release/python -m pyperf compare_to master.json kwcall-nodup.json kwcall-3: Mean +- std dev: [master] 192 us +- 2 us -> [kwcall-nodup] 175 us +- 1 us: 1.09x faster (-9%) kwcall-6: M

[issue41835] Speed up dict vectorcall creation using keywords

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: Short result (minspeed=2): Slower (4): - unpack_sequence: 65.2 ns +- 1.3 ns -> 69.2 ns +- 0.4 ns: 1.06x slower (+6%) - unpickle_list: 5.21 us +- 0.04 us -> 5.44 us +- 0.02 us: 1.04x slower (+4%) - chameleon: 9.80 ms +- 0.08 ms -> 10.0 ms +- 0.1 ms: 1.0

[issue42126] Optimize BUILD_CONST_KEY_MAP for distinct keys

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: OK. Microbenchmark don't justify adding complexity to the eval loop and the compiler. -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker <https:

[issue41835] Speed up dict vectorcall creation using keywords

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: > I did PGO+LTO... --enable-optimizations --with-lto I'm sorry about that. PGO+LTO *reduce* noises, but there are still noises. And unpack_sequence is very fragile. I tried your branch again, and unpack_sequence is 10% *slower* than master branc

[issue41835] Speed up dict vectorcall creation using keywords

2020-11-02 Thread Inada Naoki
Change by Inada Naoki : -- pull_requests: +22023 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23106 ___ Python tracker <https://bugs.python.org/issu

[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Inada Naoki
Change by Inada Naoki : -- pull_requests: +21987 pull_request: https://github.com/python/cpython/pull/23068 ___ Python tracker <https://bugs.python.org/issue42

[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Inada Naoki
Inada Naoki added the comment: > It should *not* be affected by the change. Anyway, I run the bench other 10 > times, and the lowest value with the CPython code without the PR is not lower > than 67.7 ns. With the PR, it reaches 53.5 ns. And I do not understand why. The benchmar

[issue42217] compiler: merge co_code and co_lnotab

2020-10-31 Thread Inada Naoki
Inada Naoki added the comment: @Serhiy > Do you mean sharing values of co_code and co_lnotab between code objects of > the same module? Yes. > How much memory does this save (in absolute and relative value)? Maybe 1~3%, but I am not sure. I am more interested in reducing

[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Inada Naoki
Inada Naoki added the comment: > Both changes add significant amount of code (100 and 85 lines > correspondingly). Even if they speed up a particular case of dict constructor > it is not common use case. You are right, but please wait. Marco is new contributor and he can write

[issue42217] compiler: merge co_code and co_lnotab

2020-10-31 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +21975 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23056 ___ Python tracker <https://bugs.python.org/issu

[issue42217] compiler: merge co_code and co_lnotab

2020-10-31 Thread Inada Naoki
New submission from Inada Naoki : co_consts are merged already, but I forget about code attributes other than co_consts. Duplication ratio is vary by code style, but in case of logging, we can reduce 25% of them. ``` >>> data = open('Lib/logging/__pycache__/__init__.python

[issue42216] Optimize dict.popitem() & insert use case.

2020-10-30 Thread Inada Naoki
Inada Naoki added the comment: > But `dict.popitem()` returns the last item in the insertion order. The item > must be the last item of collision chain too. This assumption was wrong. Inserting new item may overwrite dummy entry. In this case, the last item in the middle of collision

[issue42160] unnecessary overhead in tempfile

2020-10-30 Thread Inada Naoki
Inada Naoki added the comment: @Deric-W Please create another PR to change from `choise` to `choises` if you want to optimize it. -- ___ Python tracker <https://bugs.python.org/issue42

[issue42160] unnecessary overhead in tempfile

2020-10-30 Thread Inada Naoki
Inada Naoki added the comment: New changeset 43ca084c88d1e46a44199f347c72e26db84903c9 by Inada Naoki in branch 'master': Revert "bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)" https://github.com/python/cpython/commit/43ca084c88d1e46a4419

[issue41835] Speed up dict vectorcall creation using keywords

2020-10-30 Thread Inada Naoki
Inada Naoki added the comment: unpack_sequence is very sensitive benchmark. Speed is dramatically changed by code alignment. PGO+LTO will reduce the noise, but we see noise always. I believe there is no significant performance change in macro benchmarks when optimizing this part. Not

[issue42160] unnecessary overhead in tempfile

2020-10-30 Thread Inada Naoki
Change by Inada Naoki : -- pull_requests: +21974 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/23055 ___ Python tracker <https://bugs.python.org/issu

[issue42160] unnecessary overhead in tempfile

2020-10-30 Thread Inada Naoki
Inada Naoki added the comment: Oh, _RandomNameSequence is not true singleton. Instance is used in tests actually. Using `os.register_at_fork` was but idea. Let's reject it. -- ___ Python tracker <https://bugs.python.org/is

[issue42216] Optimize dict.popitem() & insert use case.

2020-10-30 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +21973 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23054 ___ Python tracker <https://bugs.python.org/issu

[issue42216] Optimize dict.popitem() & insert use case.

2020-10-30 Thread Inada Naoki
New submission from Inada Naoki : PyDict_DelItem stores DUMMY entry in the hash table. Without DUMMY, collision chain will be broken so proving will be not working. But `dict.popitem()` returns the last item in the insertion order. The item must be the last item of collision chain too. So

[issue42202] Optimize function annotation

2020-10-30 Thread Inada Naoki
Inada Naoki added the comment: > Are annotations now always known at compile time? Yes, because `from __future__ import annotations` is enabled by default from Python 3.10. > As for representation, it can also be a sequence of pairs (('x', 'int'), > ('z&#x

[issue42202] Optimize function annotation

2020-10-29 Thread Inada Naoki
New submission from Inada Naoki : Look this example: code: ``` # code def foo(x: int, /, y, *, z: float) -> Hoge: pass # dis 2 12 LOAD_CONST 2 ('int') 14 LOAD_CONST 3 ('float') 16 LOAD_CONST

[issue42160] unnecessary overhead in tempfile

2020-10-29 Thread Inada Naoki
Inada Naoki added the comment: Thanks -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 -Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.or

[issue40255] Fixing Copy on Writes from reference counting

2020-10-29 Thread Inada Naoki
Inada Naoki added the comment: >> Fast shutdown option > > You can use os._exit(0). Yes. Instagram use it as `atexit.register(os._exit, 0)`. https://instagram-engineering.com/dismissing-python-garbage-collection-at-instagram-4dca40b29172 I think this hack can be supported in mul

[issue42160] unnecessary overhead in tempfile

2020-10-29 Thread Inada Naoki
Inada Naoki added the comment: New changeset 8e409cebad42032bb7d0f2cadd8b1e36081d98af by Eric W in branch 'master': bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997) https://github.com/python/cpython/commit/8e409cebad42032bb7d0f2cadd8b1e36081d98af -- nosy

[issue42176] Valgrind reports "Conditional jump or move depends on uninitialised value(s)" in `PyUnicode_AsEncodedString` and `PyUnicode_Decode`

2020-10-28 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42176> ___ ___

[issue40255] Fixing Copy on Writes from reference counting

2020-10-25 Thread Inada Naoki
Change by Inada Naoki : -- versions: +Python 3.10 -Python 3.9 ___ Python tracker <https://bugs.python.org/issue40255> ___ ___ Python-bugs-list mailing list Unsub

[issue40255] Fixing Copy on Writes from reference counting

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: I'm big -1 too. But I am interested in Instagram usage. * How % of heap are CoW-ed with gc.freeze()? * When CoW happen? in execution time, or shutdown? * Which type cause CoW? I have two ideas to reduce CoW: * Fast shutdown option Currently Python t

[issue39189] Use io.DEFAULT_BUFFER_SIZE for filecmp BUFSIZE variable

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: I concur with Benjamin. Although two variables are similar, they are used in the different layer. -- nosy: +methane resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracke

[issue41662] Bugs in binding parameters in sqlite3

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: New changeset a053a7ecfef006b834a9957468fa461dafb332db by Miss Skeleton (bot) in branch '3.8': bpo-41662: Fix bugs in binding parameters in sqlite3 (GH-21998) https://github.com/python/cpython/commit/a053a7ecfef006b834a9957468fa461dafb332db -

[issue39871] math.copysign raises SystemError with non-float x and custom y

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: New changeset f6255a2ccb55a63194caf698f471c803c08be359 by Zackery Spytz in branch '3.8': bpo-39871: Fix an error in a news entry (GH-21749) https://github.com/python/cpython/commit/f6255a2ccb55a63194caf698f471c8

[issue33557] Windows multiprocessing doesn't propagate tabcheck to children

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: Python 2.7 became EOL. -- nosy: +methane resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32122] Improve -x option documentation

2020-10-25 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +newcomer friendly versions: +Python 3.10 -Python 2.7, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue32

[issue42147] Micro optimization for longrange iteration if step is 1

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: Oh, I didn't know that. Thank you. I thought Chinese and Korean use surname-given name order because of "Xí Jìnpíng", "Moon Jae-in", and "Kim Jong-un". Japanese previous P.M. used "Shinzo Abe" English nota

[issue42147] Micro optimization for longrange iteration if step is 1

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: > On the other hand, GH-22479 is affect to all index API() whether the number > is large or small. Then, no need to revert GH-22479 for consistency. Thanks. > p.s by the way, Naoki is the last name or first name? ;) It is difficult to say what is f

[issue42147] Micro optimization for longrange iteration if step is 1

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: I had not noticed that there are rangeobject and longrangeobject. It doesn't affect to range(1) definitely. -- ___ Python tracker <https://bugs.python.org/is

[issue42147] Micro optimization for longrange iteration if step is 1

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: I agree that 1<<1000 is artificial example. But isn't this patch affects more regular patterns like [[] for _ in range(1)]? If we reject this, shouldn't we revert GH-22479 too? I believe iterating range object is much more common use case

[issue42141] Speedup various dict inits

2020-10-25 Thread Inada Naoki
Inada Naoki added the comment: I run pyperformance=1.0.0 for your speedup_dictinit branch (7df3b9c) and master branch, with PGO+LTO build. ``` $ ./python -m pyperf compare_to master-opt.json dictinit.json -G --min-speed=1 Slower (22): - unpack_sequence: 62.7 ns +- 0.7 ns -> 70.3 ns +- 0.5

[issue29981] Update Index for set, dict, and generator 'comprehensions'

2020-10-24 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 3.7 ___ Python tracker <https://bugs.python.or

[issue42141] Speedup various dict inits

2020-10-24 Thread Inada Naoki
Inada Naoki added the comment: > 1. dicts from other dicts that are not "perfect" (combined and without holes) > 3. copies of dicts with many holes Note that I have optimized and rejected it by myself already. See https://github.com/python/cpython/pull/21669 and https:/

[issue41835] Speed up dict vectorcall creation using keywords

2020-10-24 Thread Inada Naoki
Inada Naoki added the comment: I confirmed _PyDict_FromItems() can be used to optimize _PyStack_AsDict() too. See https://github.com/methane/cpython/pull/25 But I can not confirm significant performance gain from it too. -- ___ Python tracker

<    1   2   3   4   5   6   7   8   9   10   >