| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
This cuts a bit of overhead by not initializing the table of small
odd powers unless it's needed for a large exponent.
|
| |
|
|
|
| |
The empty bytes object (b'') and the 256 one-character bytes objects were allocated at runtime init. Now we statically allocate and initialize them.
https://bugs.python.org/issue45953
|
| |
|
|
|
|
|
|
|
|
| |
(GH-30346)
When multiplying lists and tuples by `n`, increment each element's refcount, by `n`, just once.
Saves `n-1` increments per element, and allows for a leaner & faster copying loop.
Code by sweeneyde (Dennis Sweeney).
|
| |
|
|
|
|
|
|
|
|
|
| |
(GH-30422)
This reverts commit ea251806b8dffff11b30d2182af1e589caf88acf.
Keep "assert(interned == NULL);" in _PyUnicode_Fini(), but only for
the main interpreter.
Keep _PyUnicode_ClearInterned() changes avoiding the creation of a
temporary Python list object.
|
| |
|
| |
Automerge-Triggered-By: GH:pablogsal
|
| | |
|
| |
|
|
|
|
| |
* bpo-46202: remove opcode POP_EXCEPT_AND_RERAISE
* do not assume that an exception group is truthy
|
| |
|
|
|
|
|
| |
x_mul()'s squaring code can do some redundant and/or useless
work at the end of each digit pass. A more careful analysis
of worst-case carries at various digit positions allows
making that code leaner.
|
| |
|
|
| |
changes. Move helpers to exceptions.c. Do not assume that exception groups are truthy. (GH-30289)
|
| |
|
|
|
|
|
|
|
|
|
| |
* bpo-46218: Change long_pow() to sliding window algorithm
The primary motivation is to eliminate long_pow's reliance on that the number of bits in a long "digit" is a multiple of 5. Now it no longer cares how many bits are in a digit.
But the sliding window approach also allows cutting the precomputed table of small powers in half, which reduces initialization overhead enough that the approach pays off for smaller exponents too. Depending on exponent bit patterns, a sliding window may also be able to save some bigint multiplies (sometimes when at least 5 consecutive exponent bits are 0, regardless of their starting bit position modulo 5).
Note: boosting the window width to 6 didn't work well overall. It give marginal speed improvements for huge exponents, but the increased overhead (the small-power table needs twice as many entries) made it a loss for smaller exponents.
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
|
| | |
|
| |
|
| |
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
|
| | |
|
| |
|
|
| |
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
|
| | |
|
| |
|
|
| |
parts (GH-30159)
|
| |
|
| |
This reverts commit 2ef06d412531d1163dbc72877c88aedf3ed82a25.
|
| | |
|
| |
|
|
|
|
|
|
| |
* Do not PUSH/POP traceback or type to the stack as part of exc_info
* Remove exc_traceback and exc_type from _PyErr_StackItem
* Add to what's new, because this change breaks things like Cython
|
| |
|
|
|
|
| |
* Split YIELD_FROM opcode into SEND and JUMP_ABSOLUTE.
* Remove YIELD_FROM opcode.
|
| |
|
|
|
|
|
|
|
|
| |
* Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW.
* Update specialization to handle new CALL opcodes.
* Specialize call to method descriptors.
* Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
|
| | |
|
| |
|
|
|
|
|
| |
The array of small PyLong objects has been statically declared. Here I also statically initialize them. Consequently they are no longer initialized dynamically during runtime init.
I've also moved them under a new sub-struct in _PyRuntimeState, in preparation for static allocation and initialization of other global objects.
https://bugs.python.org/issue45953
|
| |
|
|
| |
(#29665)
|
| |
|
|
| |
PyImport_ImportModule (GH-30046)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
consistent. (gh-29998)
This change is strictly renames and moving code around. It helps in the following ways:
* ensures type-related init functions focus strictly on one of the three aspects (state, objects, types)
* passes in PyInterpreterState * to all those functions, simplifying work on moving types/objects/state to the interpreter
* consistent naming conventions help make what's going on more clear
* keeping API related to a type in the corresponding header file makes it more obvious where to look for it
https://bugs.python.org/issue46008
|
| |
|
|
|
| |
* bpo-45813: Drop redundant assertion from frame.clear()
* Move assertion to frame_dealloc()
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
before GC header. (GH-29879)
* Place __dict__ immediately before GC header for plain Python objects.
* Fix up lazy dict creation logic to use managed dict pointers.
* Manage values pointer, placing them directly before managed dict pointers.
* Convert hint-based load/store attr specialization target managed dict classes.
* Specialize LOAD_METHOD for managed dict objects.
* Remove unsafe _PyObject_GC_Calloc function.
* Remove unsafe _PyObject_GC_Malloc() function.
* Add comment explaning use of Py_TPFLAGS_MANAGED_DICT.
|
| |
|
|
|
|
|
| |
generator. (GH-29891)
* Make generator, coroutine and async gen structs all the same size.
* Store interpreter frame in generator (and coroutine). Reduces the number of allocations neeeded for a generator from two to one.
|
| |
|
|
| |
__note__ field (GH-29880)
|
| |
|
|
|
|
|
| |
* Add COMPARE_OP_ADAPTIVE adaptive instruction.
* Add COMPARE_OP_FLOAT_JUMP, COMPARE_OP_INT_JUMP and COMPARE_OP_STR_JUMP specialized instructions.
* Introduce and use _PyUnicode_Equal
|
| |
|
|
|
|
|
| |
Rename PyConfig.no_debug_ranges to PyConfig.code_debug_ranges and
invert the value.
Document -X no_debug_ranges and PYTHONNODEBUGRANGES env var in
PyConfig.code_debug_ranges documentation.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
to be specialized (GH-29595)
* Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead.
* Add reference to function to frame, borrow references to builtins and globals.
* Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.
|
| |
|
|
| |
deallocated. (GH-29700)
|
| |
|
|
|
| |
* Specialize STORE_SUBSCR for list[int], and dict[object]
* Adds _PyDict_SetItem_Take2 which consumes references to the key and values.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
(GH-29366)
|
| | |
|
| | |
|
| |
|
| |
* Rename 'frame' to 'current_frame'
|
| |
|
|
|
|
|
|
| |
Keep track of whether unsafe_tuple_compare() calls are resolved by the very
first tuple elements, and adjust strategy accordingly. This can significantly
cut the number of calls made to the full-blown PyObject_RichCompareBool(),
and especially when duplicates are rare.
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
| |
|
|
| |
(GH-28569)
|