[issue47177] Frames should store next_instr instead of lasti

2022-04-07 Thread Brandt Bucher


Change by Brandt Bucher :


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

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



[issue47177] Frames should store next_instr instead of lasti

2022-04-07 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset ef6a482b0285870c45f39c9b17ed827362b334ae by Brandt Bucher in 
branch 'main':
bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208)
https://github.com/python/cpython/commit/ef6a482b0285870c45f39c9b17ed827362b334ae


--

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



[issue45542] Using multiple comparison operators can cause performance issues

2022-04-07 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue47250] Add object.__getstate__() introduced refleaks

2022-04-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

Found it. This line should be removed:

https://github.com/python/cpython/blob/4c92427fb85e420404a9bd26347e32acc1bbd3b7/Objects/typeobject.c#L5033

--
nosy: +brandtbucher

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



[issue47233] show_caches option affects code positions reported by dis.get_instructions(...)

2022-04-05 Thread Brandt Bucher


Brandt Bucher  added the comment:

Nice catch. The fix should be pretty simple: just move this line...

https://github.com/python/cpython/blob/c1d93b6411f975d67e43942f1a2745a22983c18c/Lib/dis.py#L425

...up to the top of the for loop.

Are you interested in working on this?

--

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



[issue47233] show_caches option affects code positions reported by dis.get_instructions(...)

2022-04-05 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue47120] Make all jump opcodes relative

2022-03-31 Thread Brandt Bucher


Brandt Bucher  added the comment:

Another benefit of this work is that we'll be able to remove `first_instr` from 
the eval loop.

--

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



[issue47120] Make all jump opcodes relative

2022-03-31 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-31 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +30297
pull_request: https://github.com/python/cpython/pull/3

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



[issue47177] Frames should store next_instr instead of lasti

2022-03-30 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +30283
pull_request: https://github.com/python/cpython/pull/32208

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



[issue47177] Frames should store next_instr instead of lasti

2022-03-30 Thread Brandt Bucher


New submission from Brandt Bucher :

Rather than maintaining the offset of the "last instruction" (`f_lasti`), 
interpreter frames should instead just maintain a pointer to the true next 
instruction. This has several benefits, most notably reducing the register 
pressure associated with loading first_instr on every instruction and call in 
the main interpreter loop:

When entering a frame:

- Before: `next_instr = first_instr + frame->f_lasti + 1;`
- After:  `next_instr = frame->next_instr;`

When starting a new instruction:

- Before: `frame->next_instr = next_instr++ - first_instr;`
- After:  `frame->next_instr = ++next_instr;`

Benchmarks suggest that this overhead is surprisingly significant (something 
like 2%).

--
assignee: brandtbucher
components: Interpreter Core
messages: 416409
nosy: Mark.Shannon, brandtbucher
priority: normal
severity: normal
stage: patch review
status: open
title: Frames should store next_instr instead of lasti
type: performance
versions: Python 3.11

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



[issue46841] Inline bytecode caches

2022-03-30 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +30280
pull_request: https://github.com/python/cpython/pull/32205

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



[issue47172] Make virtual opcodes in the compiler > 256 and is_jump() identify only proper jumps

2022-03-30 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46864] Deprecate ob_shash in BytesObject

2022-03-24 Thread Brandt Bucher


Brandt Bucher  added the comment:

Just a note: as of this week (GH-31888), we no longer use bytes objects to 
store bytecode. Instead, the instructions are stored as part of the 
PyCodeObject struct.

(Of course, we still use bytes objects for the various exception handling and 
debugging tables attached to code objects, but these are very cold fields by 
comparison.)

Not to say this work isn't worthwhile, but it probably isn't worth doing for 
`co_code` *alone*.

--

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



[issue46841] Inline bytecode caches

2022-03-17 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +30057
pull_request: https://github.com/python/cpython/pull/31968

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



[issue47046] Add `f_state` attribute to FrameObjects.

2022-03-17 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46817] Add a line-start table to the code object.

2022-03-16 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-15 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 49e1e1e1bd59cac1855b1ef4dec05d649ebcd81a by Mark Shannon in 
branch 'main':
bpo-46841: Don't scan backwards in bytecode (GH-31901)
https://github.com/python/cpython/commit/49e1e1e1bd59cac1855b1ef4dec05d649ebcd81a


--

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



[issue46841] Inline bytecode caches

2022-03-14 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29986
pull_request: https://github.com/python/cpython/pull/31888

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



[issue46841] Inline bytecode caches

2022-03-11 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset a89c29fbcc7e7e85848499443d819c3fab68c78a by Brandt Bucher in 
branch 'main':
bpo-46841: Add a _Py_SET_OPCODE macro (GH-31780)
https://github.com/python/cpython/commit/a89c29fbcc7e7e85848499443d819c3fab68c78a


--

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



[issue46965] Enable informing callee it's awaited via vector call flag

2022-03-09 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29886
pull_request: https://github.com/python/cpython/pull/31780

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



[issue46961] Caching/interning of small ints sometimes fails

2022-03-08 Thread Brandt Bucher

Brandt Bucher  added the comment:

Related, except this seems to be happening in long_pow. I’ll take a look at it 
today.

--
assignee:  -> brandtbucher

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



[issue46961] Caching/interning of small ints sometimes fails

2022-03-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-07 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29859
pull_request: https://github.com/python/cpython/pull/31742

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



[issue46841] Inline bytecode caches

2022-03-07 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset f193631387bfee99a812e39b05d5b7e6384b57f5 by Brandt Bucher in 
branch 'main':
bpo-46841: Use inline caching for calls (GH-31709)
https://github.com/python/cpython/commit/f193631387bfee99a812e39b05d5b7e6384b57f5


--

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



[issue46939] Specialize calls for Python classes

2022-03-06 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-06 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29828
pull_request: https://github.com/python/cpython/pull/31709

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



[issue46841] Inline bytecode caches

2022-03-04 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset c4d2d57eefb1224a12e2e95e4508658dfbf6a7c9 by Brandt Bucher in 
branch 'main':
bpo-46841: Fix BINARY_OP's handling of inline caches (GH-31671)
https://github.com/python/cpython/commit/c4d2d57eefb1224a12e2e95e4508658dfbf6a7c9


--

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



[issue46896] add support for watching writes to selected dictionaries

2022-03-04 Thread Brandt Bucher

Brandt Bucher  added the comment:

> Why so coarse?

> Getting a notification for every change of a global in module, is likely to 
> make use the use of global variables extremely expensive.

Perhaps a compromise is possible here: one global group/chain of callbacks 
registered for all dictionaries in an interpreter seems reasonable (to keep 
overhead low), but we could reduce the number of times it’s actually called by, 
say, tagging specific values of specific dictionaries to be watched.

For example, we could just tag the low bit of any pointer in a dictionary’s 
values that we want to be notified of changes to. Something like that seems 
like it could really keep the cost of watching down without sacrificing power.

--

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



[issue46923] Implement stack overflow protection for supported platforms

2022-03-04 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-03 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 05a8bc1c944709e7468f157bd1b6032f368e43bf by Brandt Bucher in 
branch 'main':
bpo-46841: Use inline caching for attribute accesses (GH-31640)
https://github.com/python/cpython/commit/05a8bc1c944709e7468f157bd1b6032f368e43bf


--

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



[issue46841] Inline bytecode caches

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29791
pull_request: https://github.com/python/cpython/pull/31671

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



[issue46841] Inline bytecode caches

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29783
pull_request: https://github.com/python/cpython/pull/31664

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



[issue44800] Code readability: rename InterpreterFrame to `_Py_framedata`

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46896] add support for watching writes to selected dictionaries

2022-03-03 Thread Brandt Bucher


Brandt Bucher  added the comment:

Also, when you say "only one global callback": does that mean per-interpreter, 
or per-process?

--

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



[issue46896] add support for watching writes to selected dictionaries

2022-03-03 Thread Brandt Bucher

Brandt Bucher  added the comment:

> CPython will track only one global callback; it is a well-behaved client’s 
> responsibility to check if a callback is already set when setting a new one, 
> and daisy-chain to the previous callback if so.

Hm, this is a bit scary. Could we (or others) end up with unguarded stale 
caches if some buggy extension forgets to chain the calls correctly?

Core CPython seems most at risk of this, since we would most likely be 
registered first.

--

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



[issue46896] add support for watching writes to selected dictionaries

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE combined opcode

2022-03-03 Thread Brandt Bucher


Brandt Bucher  added the comment:

Reopening since this needed to be removed for 
https://github.com/python/cpython/pull/31640.

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

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



[issue46841] Inline bytecode caches

2022-03-03 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 127797f572cc7374192e415c44ea2e95b009d5ab by Brandt Bucher in 
branch 'main':
bpo-46841: Improve the failure stats for COMPARE_OP (GH-31663)
https://github.com/python/cpython/commit/127797f572cc7374192e415c44ea2e95b009d5ab


--

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



[issue46908] Debugger jumps to a wrong instruction in for loop

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-03 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29782
pull_request: https://github.com/python/cpython/pull/31663

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



[issue46864] Deprecate ob_shash in BytesObject

2022-03-02 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-03-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

> What I *think* is happening is that the inline cache takes the size of the 
> function (in code units) from about 4800 to about 5200, crossing our 
> threshold for quickening (currently set to 5000).

Yep, nailed it:

>>> len(list(dis.get_instructions(do_unpacking)))
4827
>>> len(list(dis.get_instructions(do_unpacking, show_caches=True)))
5251
>>> do_unpacking(1_000, range(10))
0.06478393300494645
>>> do_unpacking.__code__._co_quickened is None
True

--

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



[issue46841] Inline bytecode caches

2022-03-01 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29761
pull_request: https://github.com/python/cpython/pull/31640

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



[issue46836] [C API] Move PyFrameObject to the internal C API

2022-03-01 Thread Brandt Bucher


Brandt Bucher  added the comment:

I'm also very uncomfortable with the lack of review on these PRs. The most 
recent one (https://github.com/python/cpython/pull/31583) was open for less 
than 30 minutes before merging, from 6:57 to 7:22 am in my local time zone.

--

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



[issue46836] [C API] Move PyFrameObject to the internal C API

2022-03-01 Thread Brandt Bucher


Brandt Bucher  added the comment:

Victor, can we please revert these changes? They broke Greenlet, a required 
dependency for three of our performance benchmarks:

https://github.com/python-greenlet/greenlet/issues/288#issuecomment-1055632607

I've already spent considerable effort contributing workarounds for other 3.11 
breakages in Greenlet and coaxing them to put out a compatible release:

https://github.com/python-greenlet/greenlet/pull/280

These changes, however, just seem like needless breakage that are now also 
impacting our performance work.

--

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



[issue46841] Inline bytecode caches

2022-02-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29747
pull_request: https://github.com/python/cpython/pull/31622

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



[issue46841] Inline bytecode caches

2022-02-25 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29714
pull_request: https://github.com/python/cpython/pull/31591

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



[issue46836] [C API] Move PyFrameObject to the internal C API

2022-02-25 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46850] [C API] Move _PyEval_EvalFrameDefault() to the internal C API

2022-02-25 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46808] remove NEXT_BLOCK() from compile.c

2022-02-25 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue45431] [C API] Rename CFrame or hide it to only export names starting with Py

2022-02-25 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46841] Inline bytecode caches

2022-02-23 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +29666
pull_request: https://github.com/python/cpython/pull/31543

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



[issue46841] Inline bytecode caches

2022-02-23 Thread Brandt Bucher


New submission from Brandt Bucher :

...as discussed in https://github.com/faster-cpython/ideas/discussions/263.

My plan is for this initial PR to lay the groundwork, then to work on porting 
over the existing opcode caches one-by-one. Once that's done, we can clean up 
lots of the "old" machinery.

--
assignee: brandtbucher
components: Interpreter Core
messages: 413875
nosy: Mark.Shannon, brandtbucher
priority: normal
severity: normal
stage: patch review
status: open
title: Inline bytecode caches
type: performance
versions: Python 3.11

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



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

2022-02-23 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue45107] Improve LOAD_METHOD specialization

2022-02-23 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-23 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue44337] Port LOAD_ATTR to adaptive interpreter

2022-02-23 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 281ea9c39146a00cdf3fa2b3d0be60e2a39278ce by Brandt Bucher in 
branch 'main':
bpo-44337: Shrink the LOAD_ATTR/STORE_ATTR caches (GH-31517)
https://github.com/python/cpython/commit/281ea9c39146a00cdf3fa2b3d0be60e2a39278ce


--

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



[issue44337] Port LOAD_ATTR to adaptive interpreter

2022-02-22 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 3.0 -> 4.0
pull_requests: +29644
pull_request: https://github.com/python/cpython/pull/31517

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



[issue45885] Specialize COMPARE_OP

2022-02-22 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 2.0 -> 3.0
pull_requests: +29643
pull_request: https://github.com/python/cpython/pull/31516

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



[issue46329] Split up the CALL_NO_KW and CALL_KW instructions.

2022-02-22 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29638
pull_request: https://github.com/python/cpython/pull/31511

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



[issue46702] Specialize UNPACK_SEQUENCE

2022-02-18 Thread Brandt Bucher


Brandt Bucher  added the comment:

Closing as UNPACK_SEQUENCE_TWO_TUPLE__STORE_FAST__STORE_FAST results in lots of 
hits, but no performance improvement.

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

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



[issue46748] Python.h includes stdbool.h

2022-02-18 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46072] Unify handling of stats in the CPython VM

2022-02-16 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 580cd9ab2992b7df6f4815020b5841e14a5a6977 by Brandt Bucher in 
branch 'main':
bpo-46072: Add detailed failure stats for BINARY_OP (GH-31289)
https://github.com/python/cpython/commit/580cd9ab2992b7df6f4815020b5841e14a5a6977


--

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



[issue46702] Specialize UNPACK_SEQUENCE

2022-02-16 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset a9da085015db8cbb81f660158864ac94fe6c67a2 by Brandt Bucher in 
branch 'main':
bpo-46702: Specialize UNPACK_SEQUENCE (GH-31240)
https://github.com/python/cpython/commit/a9da085015db8cbb81f660158864ac94fe6c67a2


--

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



[issue46072] Unify handling of stats in the CPython VM

2022-02-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 2.0 -> 3.0
pull_requests: +29449
pull_request: https://github.com/python/cpython/pull/31289

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



[issue45923] Improve performance of sys.settracing based tools.

2022-02-09 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 3.0 -> 4.0
pull_requests: +29413
pull_request: https://github.com/python/cpython/pull/31244

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



[issue46702] Specialize UNPACK_SEQUENCE

2022-02-09 Thread Brandt Bucher


Brandt Bucher  added the comment:

(I also plan on looking into an adaptive super-duper-instruction for 
UNPACK_SEQUENCE_TWO_TUPLE__STORE_FAST__STORE_FAST after the current PR has 
landed).

--

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



[issue46702] Specialize UNPACK_SEQUENCE

2022-02-09 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +29410
pull_request: https://github.com/python/cpython/pull/31240

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



[issue46702] Specialize UNPACK_SEQUENCE

2022-02-09 Thread Brandt Bucher


New submission from Brandt Bucher :

UNPACK_SEQUENCE already has fast paths for tuples and lists, which make up 
(literally) 99% of unpackings in the benchmark suite. What's more, two-element 
tuples make up about two-thirds of all unpackings (though I actually suspect 
it's even higher, since the unpack_sequence benchmark is definitely skewing the 
results towards 10-element lists and tuples).

These specializations are trivial to implement and result in a solid 1% 
improvement overall.

--
assignee: brandtbucher
components: Interpreter Core
messages: 412960
nosy: Mark.Shannon, brandtbucher
priority: normal
severity: normal
stage: patch review
status: open
title: Specialize UNPACK_SEQUENCE
type: performance
versions: Python 3.11

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



[issue46528] Simplify the VM's stack manipulations

2022-02-09 Thread Brandt Bucher


Change by Brandt Bucher :


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

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



[issue46528] Simplify the VM's stack manipulations

2022-02-09 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 78ae4cc6dc949e8bc39fab25fea5efe983dc0ad1 by Brandt Bucher in 
branch 'main':
bpo-46528: Attempt SWAPs at compile-time (GH-30970)
https://github.com/python/cpython/commit/78ae4cc6dc949e8bc39fab25fea5efe983dc0ad1


--

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



[issue46528] Simplify the VM's stack manipulations

2022-02-09 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 46328d8ae6529db916ccaabb9247fb0327ce0c1e by Brandt Bucher in 
branch 'main':
bpo-46528: Check PyMem_Malloc for NULL (GH-30998)
https://github.com/python/cpython/commit/46328d8ae6529db916ccaabb9247fb0327ce0c1e


--

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



[issue45773] Compiler hangs during jump elimination

2022-02-03 Thread Brandt Bucher


Change by Brandt Bucher :


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

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



[issue45773] Compiler hangs during jump elimination

2022-02-01 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29251
pull_request: https://github.com/python/cpython/pull/31066

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



[issue45773] Compiler hangs during jump elimination

2022-02-01 Thread Brandt Bucher


Brandt Bucher  added the comment:

My fix for this seems to have erroneously added two invalid new jump threads:

POP_JUMP_IF_FALSE(a) to JUMP_IF_FALSE_OR_POP(b) is folded into 
POP_JUMP_IF_FALSE(b)
POP_JUMP_IF_TRUE(a) to JUMP_IF_TRUE_OR_POP(b) is folded into POP_JUMP_IF_TRUE(b)

The good news is that I can't get the compiler to actually emit these 
particular jump sequences. It still needs to be fixed ASAP, though.

--
nosy: +pablogsal
priority: high -> release blocker
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open
type: crash -> behavior

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



[issue46528] Simplify the VM's stack manipulations

2022-02-01 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset a0e55a571cf01885fd5826266c37abaee307c309 by Brandt Bucher in 
branch 'main':
bpo-46528: Simplify BUILD_TUPLE/UNPACK_SEQUENCE folding (GH-31039)
https://github.com/python/cpython/commit/a0e55a571cf01885fd5826266c37abaee307c309


--

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



[issue46528] Simplify the VM's stack manipulations

2022-01-31 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29222
pull_request: https://github.com/python/cpython/pull/31039

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



[issue45953] Statically allocate interpreter states as much as possible.

2022-01-28 Thread Brandt Bucher


Brandt Bucher  added the comment:

Any chance we could revert the recent renaming of tstate.exc_state and 
tstate.root_cframe in https://github.com/python/cpython/pull/30590? It broke 
Greenlet again:

https://github.com/python-greenlet/greenlet/issues/288

If it's only a name change (and the members themselves are the same), I think 
reverting it is preferable to burying Greenlet in more compatibility macros and 
bugging them to put out another new release.

--
nosy: +brandtbucher

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



[issue45628] TimedRotatingFileHandler backupCount not working

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy:  -brandtbucher

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



[issue45628] TimedRotatingFileHandler backupCount not working

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests:  -29179

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



[issue46528] Simplify the VM's stack manipulations

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29180
pull_request: https://github.com/python/cpython/pull/30998

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



[issue45628] TimedRotatingFileHandler backupCount not working

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 3.0 -> 4.0
pull_requests: +29179
pull_request: https://github.com/python/cpython/pull/30998

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



[issue46528] Simplify the VM's stack manipulations

2022-01-28 Thread Brandt Bucher


Brandt Bucher  added the comment:

Hm, yeah. Bummer that this needs error handling now.

I'll have a fix up soon.

--

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Brandt Bucher


Brandt Bucher  added the comment:

> I did an experiment to double the number of instructions.

Were the extra instructions just NOPs, or were they actually doing any work?

If they were NOPs, then presumably those numbers tell us more about the 
overhead of dispatch and cache pressure than anything else.

--

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Brandt Bucher


Brandt Bucher  added the comment:

In a typical run of the pyperformance benchmark suite, rotations account for a 
bit over 1% of all instructions executed.

I don't have timings for individual instructions, unfortunately.

--

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29148
pull_request: https://github.com/python/cpython/pull/30970

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



[issue46528] Simplify the VM's stack manipulations

2022-01-26 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 85483668647e7840c7b9a1877caaf2ef14a4443f by Brandt Bucher in 
branch 'main':
bpo-46528: Simplify the VM's stack manipulations (GH-30902)
https://github.com/python/cpython/commit/85483668647e7840c7b9a1877caaf2ef14a4443f


--

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



[issue42926] Split compiler into code-gen, optimizer and assembler.

2022-01-26 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue33205] GROWTH_RATE prevents dict shrinking

2022-01-26 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46465] Regression caused by CALL_FUNCTION specialization for C function calls

2022-01-26 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46528] Simplify the VM's stack manipulations

2022-01-25 Thread Brandt Bucher


Brandt Bucher  added the comment:

In practice, pretty much the only thing that will do more work now is augmented 
subscription:

>>> a[b] += c

main:

  1   2 LOAD_NAME0 (a)
  4 LOAD_NAME1 (b)
  6 DUP_TOP_TWO
  8 BINARY_SUBSCR
 10 LOAD_NAME2 (c)
 12 BINARY_OP   13 (+=)
 14 ROT_THREE
 16 STORE_SUBSCR

patched:

  1   2 LOAD_NAME0 (a)
  4 LOAD_NAME1 (b)
  6 COPY 2
  8 COPY 2
 10 BINARY_SUBSCR
 12 LOAD_NAME2 (c)
 14 BINARY_OP   13 (+=)
 16 SWAP 3
 18 SWAP 2
 20 STORE_SUBSCR

Pattern matching is the only place where we use ROT_N, and frankly it's 
*misused* there... often, it makes the cost of storing names quadratic at 
runtime. Even though we emit *more* instructions now, the peephole optimizer 
actually cuts them down significantly, and the result is more efficient than 
before. For example:

>>> match x:
... case (a, b, c, None):
... pass

main:

  1   2 LOAD_NAME0 (x)

  2   4 MATCH_SEQUENCE
  6 POP_JUMP_IF_FALSE   20 (to 40)
  8 GET_LEN
 10 LOAD_CONST   0 (4)
 12 COMPARE_OP   2 (==)
 14 POP_JUMP_IF_FALSE   20 (to 40)
 16 UNPACK_SEQUENCE  4
 18 ROT_FOUR
 20 ROT_FOUR
 22 ROT_FOUR
 24 POP_JUMP_IF_NOT_NONE18 (to 36)
 26 STORE_NAME   1 (a)
 28 STORE_NAME   2 (b)
 30 STORE_NAME   3 (c)

  3  32 LOAD_CONST   1 (None)
 34 RETURN_VALUE

  2 >>   36 POP_TOP
 38 POP_TOP
>>   40 POP_TOP
 42 LOAD_CONST   1 (None)
 44 RETURN_VALUE

patched:

  1   2 LOAD_NAME0 (x)

  2   4 MATCH_SEQUENCE
  6 POP_JUMP_IF_FALSE   20 (to 40)
  8 GET_LEN
 10 LOAD_CONST   0 (4)
 12 COMPARE_OP   2 (==)
 14 POP_JUMP_IF_FALSE   20 (to 40)
 16 UNPACK_SEQUENCE  4
 18 SWAP 2
 20 SWAP 3
 22 SWAP 4
 24 POP_JUMP_IF_NOT_NONE18 (to 36)
 26 STORE_NAME   1 (a)
 28 STORE_NAME   2 (b)
 30 STORE_NAME   3 (c)

  3  32 LOAD_CONST   1 (None)
 34 RETURN_VALUE

  2 >>   36 POP_TOP
 38 POP_TOP
>>   40 POP_TOP
 42 LOAD_CONST   1 (None)
 44 RETURN_VALUE

Replacing the ROT_FOURs with SWAPs may seem minor, but it ends up being a *lot* 
less work at runtime.

--

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



[issue46528] Simplify the VM's stack manipulations

2022-01-25 Thread Brandt Bucher


Change by Brandt Bucher :


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

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



[issue46528] Simplify the VM's stack manipulations

2022-01-25 Thread Brandt Bucher


New submission from Brandt Bucher :

...as discussed in https://github.com/faster-cpython/ideas/discussions/228.

We can dramatically simplify our stack manipulations by getting rid of the 
`DUP_TOP*` and `ROT_*` families of instructions:

- Replace `DUP_TOP` with `COPY(1)`.
- Replace `DUP_TOP_TWO` with `COPY(2), COPY(2)`.
- Introduce a new `SWAP` instruction.
  - Replace `ROT_TWO` with `SWAP(2)`.
  - Replace `ROT_THREE` with `SWAP(3), SWAP(2)`.
  - Remove `ROT_FOUR`.
  - Replace `ROT_N(n)` with `SWAP(n), SWAP(n - 1), ..., SWAP(2)`.

It then becomes much simpler for the peephole optimizer to reason about code 
sequences involving these instructions (for example, it's pretty 
straightforward to truly *optimize* an arbitrary sequence of swaps).

--
assignee: brandtbucher
components: Interpreter Core
messages: 411697
nosy: Mark.Shannon, brandtbucher
priority: normal
severity: normal
status: open
title: Simplify the VM's stack manipulations
type: performance
versions: Python 3.11

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



[issue46378] Experiment with LLVM BOLT binary optimizer

2022-01-15 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

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



[issue46372] int/float specializations should mutate the LHS in-place when possible

2022-01-13 Thread Brandt Bucher


Change by Brandt Bucher :


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

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



[issue46372] int/float specializations should mutate the LHS in-place when possible

2022-01-13 Thread Brandt Bucher


New submission from Brandt Bucher :

The performance of our existing int and float specializations can be improved 
by mutating the LHS operand in-place when possible. This leads to significant 
speedups for several number-crunching benchmarks, and a solid 1% improvement 
overall:

Slower (16):
- regex_effbot: 3.14 ms +- 0.01 ms -> 3.26 ms +- 0.03 ms: 1.04x slower
- pidigits: 197 ms +- 0 ms -> 203 ms +- 0 ms: 1.03x slower
- pickle_list: 4.40 us +- 0.05 us -> 4.51 us +- 0.05 us: 1.02x slower
- logging_silent: 106 ns +- 2 ns -> 108 ns +- 1 ns: 1.02x slower
- unpickle_pure_python: 248 us +- 2 us -> 253 us +- 4 us: 1.02x slower
- xml_etree_generate: 80.3 ms +- 0.5 ms -> 81.5 ms +- 0.7 ms: 1.02x slower
- telco: 6.50 ms +- 0.10 ms -> 6.60 ms +- 0.11 ms: 1.02x slower
- go: 149 ms +- 1 ms -> 151 ms +- 2 ms: 1.01x slower
- pickle: 9.82 us +- 0.07 us -> 9.94 us +- 0.13 us: 1.01x slower
- xml_etree_process: 58.0 ms +- 0.6 ms -> 58.6 ms +- 0.5 ms: 1.01x slower
- pickle_pure_python: 329 us +- 5 us -> 332 us +- 2 us: 1.01x slower
- regex_dna: 217 ms +- 3 ms -> 219 ms +- 0 ms: 1.01x slower
- json_loads: 25.3 us +- 0.2 us -> 25.6 us +- 0.3 us: 1.01x slower
- scimark_fft: 328 ms +- 9 ms -> 331 ms +- 5 ms: 1.01x slower
- 2to3: 263 ms +- 1 ms -> 264 ms +- 1 ms: 1.01x slower
- deltablue: 4.20 ms +- 0.04 ms -> 4.22 ms +- 0.03 ms: 1.00x slower

Faster (24):
- scimark_sparse_mat_mult: 4.82 ms +- 0.20 ms -> 4.31 ms +- 0.37 ms: 1.12x 
faster
- spectral_norm: 97.0 ms +- 0.8 ms -> 89.3 ms +- 0.6 ms: 1.09x faster
- fannkuch: 418 ms +- 7 ms -> 385 ms +- 4 ms: 1.08x faster
- unpack_sequence: 48.6 ns +- 2.6 ns -> 46.1 ns +- 3.5 ns: 1.05x faster
- scimark_lu: 115 ms +- 4 ms -> 110 ms +- 2 ms: 1.05x faster
- scimark_monte_carlo: 72.2 ms +- 1.1 ms -> 69.9 ms +- 0.8 ms: 1.03x faster
- nbody: 99.4 ms +- 2.1 ms -> 96.9 ms +- 1.7 ms: 1.03x faster
- chaos: 72.5 ms +- 0.7 ms -> 70.9 ms +- 0.5 ms: 1.02x faster
- nqueens: 84.6 ms +- 0.7 ms -> 82.8 ms +- 0.5 ms: 1.02x faster
- pickle_dict: 27.1 us +- 0.1 us -> 26.7 us +- 0.1 us: 1.02x faster
- regex_v8: 24.3 ms +- 0.4 ms -> 24.0 ms +- 0.4 ms: 1.01x faster
- sqlalchemy_imperative: 19.1 ms +- 0.7 ms -> 18.8 ms +- 0.2 ms: 1.01x faster
- float: 77.4 ms +- 0.9 ms -> 76.7 ms +- 0.9 ms: 1.01x faster
- sqlalchemy_declarative: 147 ms +- 3 ms -> 146 ms +- 3 ms: 1.01x faster
- hexiom: 6.68 ms +- 0.06 ms -> 6.63 ms +- 0.03 ms: 1.01x faster
- sympy_sum: 169 ms +- 2 ms -> 168 ms +- 2 ms: 1.01x faster
- json_dumps: 12.8 ms +- 0.2 ms -> 12.7 ms +- 0.2 ms: 1.01x faster
- logging_format: 6.42 us +- 0.08 us -> 6.37 us +- 0.09 us: 1.01x faster
- python_startup_no_site: 5.81 ms +- 0.00 ms -> 5.77 ms +- 0.00 ms: 1.01x faster
- sympy_integrate: 21.5 ms +- 0.1 ms -> 21.4 ms +- 0.1 ms: 1.01x faster
- dulwich_log: 65.4 ms +- 0.5 ms -> 65.1 ms +- 0.5 ms: 1.00x faster
- crypto_pyaes: 83.5 ms +- 0.5 ms -> 83.1 ms +- 0.4 ms: 1.00x faster
- raytrace: 309 ms +- 3 ms -> 307 ms +- 2 ms: 1.00x faster
- python_startup: 8.18 ms +- 0.01 ms -> 8.15 ms +- 0.01 ms: 1.00x faster

Benchmark hidden because not significant (18): chameleon, django_template, 
logging_simple, mako, meteor_contest, pathlib, pyflate, regex_compile, 
richards, scimark_sor, sqlite_synth, sympy_expand, sympy_str, tornado_http, 
unpickle, unpickle_list, xml_etree_parse, xml_etree_iterparse

Geometric mean: 1.01x faster

--
assignee: brandtbucher
components: Interpreter Core
messages: 410544
nosy: Mark.Shannon, brandtbucher, gvanrossum
priority: normal
severity: normal
status: open
title: int/float specializations should mutate the LHS in-place when possible
type: performance
versions: Python 3.11

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



  1   2   3   4   5   6   >