cpython/Objects
Tim Peters 8383915031
GH-116939: Rewrite binarysort() (#116940)
Rewrote binarysort() for clarity.

Also changed the signature to be more coherent (it was mixing sortslice with raw pointers).

No change in method or functionality. However, I left some experiments in, disabled for now
via `#if` tricks. Since this code was first written, some kinds of comparisons have gotten
enormously faster (like for lists of floats), which changes the tradeoffs.

For example, plain insertion sort's simpler innermost loop and highly predictable branches
leave it very competitive (even beating, by a bit) binary insertion when comparisons are
very cheap, despite that it can do many more compares. And it wins big on runs that
are already sorted (moving the next one in takes only 1 compare then).

So I left code for a plain insertion sort, to make future experimenting easier.

Also made the maximum value of minrun a `#define` (``MAX_MINRUN`) to make
experimenting with that easier too.

And another bit of `#if``-disabled code rewrites binary insertion's innermost loop to
remove its unpredictable branch. Surprisingly, this doesn't really seem to help
overall. I'm unclear on why not. It certainly adds more instructions, but they're very
simple, and it's hard to be believe they cost as much as a branch miss.
2024-03-21 22:27:25 -05:00
..
clinic gh-116621: Set manual critical section for list.extend (gh-116657) 2024-03-13 07:28:23 +09:00
mimalloc gh-115103: Delay reuse of mimalloc pages that store PyObjects (#115435) 2024-03-06 09:42:11 -05:00
stringlib
abstract.c gh-116316: Fix typo in UNARY_FUNC(PyNumber_Positive) macros (GH-116317) 2024-03-04 17:57:01 +00:00
boolobject.c
bytearrayobject.c gh-115323: Add meaningful error message for using bytearray.extend with str (#115332) 2024-02-24 18:34:45 -05:00
bytes_methods.c
bytesobject.c
call.c
capsule.c
cellobject.c
classobject.c
codeobject.c gh-108716:: Remove _PyStaticCode_Init/Fini (#117141) 2024-03-22 01:27:48 +00:00
complexobject.c
descrobject.c gh-101860: Expose __name__ on property (GH-101876) 2024-02-20 17:14:34 +02:00
dictnotes.txt
dictobject.c gh-112075: Enable freeing with qsbr and fallback to lock on key changed (GH-116336) 2024-03-05 09:08:18 +00:00
enumobject.c
exception_handling_notes.txt
exceptions.c gh-114570: Add PythonFinalizationError exception (#115352) 2024-02-14 23:35:06 +01:00
fileobject.c
floatobject.c gh-116714: Handle errors correctly in PyFloat_GetInfo (#116715) 2024-03-13 12:38:03 +00:00
frame_layout.md
frameobject.c gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781) 2024-03-19 09:20:38 +00:00
funcobject.c gh-117045: Add code object to function version cache (#117028) 2024-03-21 12:37:41 -07:00
genericaliasobject.c
genobject.c gh-111968: Split _Py_async_gen_asend_freelist out of _Py_async_gen_fr… (gh-115546) 2024-02-17 10:03:10 +09:00
iterobject.c
listobject.c GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt
locations.md
longobject.c gh-110819: Fix ‘kind’ may be used uninitialized warning in longobject (#116599) 2024-03-12 13:50:06 +03:00
memoryobject.c
methodobject.c gh-114626: add PyCFunctionFast and PyCFunctionFastWithKeywords (GH-114627) 2024-02-15 11:05:20 +01:00
moduleobject.c gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438) 2024-03-07 11:21:08 +02:00
namespaceobject.c
object.c gh-76785: Drop PyInterpreterID_Type (gh-117101) 2024-03-21 17:15:02 +00:00
object_layout.md
object_layout_312.gv
object_layout_312.png
object_layout_full_312.gv
object_layout_full_312.png
obmalloc.c gh-112075: Support freeing object memory via QSBR (#116344) 2024-03-08 09:56:36 -08:00
odictobject.c gh-112075: Add critical sections for most dict APIs (#114508) 2024-02-06 14:03:43 -08:00
picklebufobject.c
rangeobject.c
README
setobject.c gh-112069: Make sets thread-safe with the GIL disabled (#113800) 2024-03-08 16:25:34 -05:00
sliceobject.c gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329) 2024-02-14 00:32:51 +00:00
structseq.c GH-108362: Incremental Cycle GC (GH-116206) 2024-03-20 08:54:42 +00:00
tupleobject.c gh-116381: Remove bad specializations, add fail stats (GH-116464) 2024-03-08 00:21:21 +08:00
typeobject.c gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781) 2024-03-19 09:20:38 +00:00
typeslots.inc
typeslots.py
typevarobject.c
unicodectype.c
unicodeobject.c gh-113964: Don't prevent new threads until all non-daemon threads exit (#116677) 2024-03-19 14:40:20 -04:00
unicodetype_db.h
unionobject.c
weakrefobject.c gh-111926: Simplify proxy creation logic (#116844) 2024-03-15 09:58:40 -04:00

Source files for various builtin objects