Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
748 commits
Select commit Hold shift + click to select a range
db378a6
perf: with over a memoryview or file loads the type's __enter__/__exi…
owenthcarey Nov 23, 2026
8452f66
fix: the C API exports the UTF-16/UTF-32/UTF-7 and escape decoders, t…
owenthcarey Nov 23, 2026
794a2b6
perf: tier 2 leaves loops over lists of objects with little typed wor…
owenthcarey Nov 23, 2026
09a5f57
perf: a leaf plan's hash((a, b)) hashes the items as the tuple would,…
owenthcarey Nov 23, 2026
e113f5f
perf: tier 2's object-loop rule counts only the loop's own typed work…
owenthcarey Nov 23, 2026
f35f6d7
perf: a compiled leaf plan reads a __slots__ member first when the si…
owenthcarey Nov 23, 2026
68b5786
perf: a leaf plan's other.__class__ is self.__class__ compares the in…
owenthcarey Nov 23, 2026
7ff4cd3
perf: a keyword-free partial call that passes exactly the parameters …
owenthcarey Nov 23, 2026
03752c4
perf: str(e), repr(e) and f"{e}" call an exception's native method wi…
owenthcarey Nov 23, 2026
4d3d7db
perf: FOR_ITER fuses with UNPACK_SEQUENCE 3 and 4 (a zip of plain seq…
owenthcarey Nov 23, 2026
f20a1df
perf: a float's e and g formats take its exact digits in one formatti…
owenthcarey Nov 23, 2026
5dbc7af
perf: one-byte bytes objects are shared as in CPython (split pieces a…
owenthcarey Nov 23, 2026
dd5803f
perf: the frame JIT lowers a subscript's Python __getitem__ in line (…
owenthcarey Nov 23, 2026
8d8e7eb
perf: tier 2 counts a comparison at an instance site as a dynamic Pyt…
owenthcarey Nov 23, 2026
cffe7e7
fix: the frame-coverage tests build Probes with the new py_operator p…
owenthcarey Nov 23, 2026
78f5d21
perf: deque.rotate takes the deque's parts unguarded in one pass over…
owenthcarey Nov 23, 2026
bad3523
perf: a leaf store the site's cache doesn't serve takes a __slots__ m…
owenthcarey Nov 23, 2026
8d39fb7
perf: compiled BUILD_STRING joins up to sixteen parts, and a slice st…
owenthcarey Nov 23, 2026
bbb33a4
perf: an enumerate over a temporary list or tuple of plain values ret…
owenthcarey Nov 23, 2026
7fde0af
perf: the leaf slot-store fallback checks the class's slot layout bef…
owenthcarey Nov 23, 2026
ba544b6
test: the packaging self-test repeats its packaging==26.3 pin, since …
owenthcarey Nov 23, 2026
3f9cf10
perf: keyword calls of native methods run in place, a keyword half's …
owenthcarey Nov 24, 2026
0124ad3
perf: getattr with a default answers a module's miss (no __getattr__)…
owenthcarey Nov 24, 2026
58aed6a
perf: sum() of a list or tuple with floats stays in the compiled call…
owenthcarey Nov 24, 2026
96bc1dd
perf: sorted/min/max compute a leaf builtin's or bound leaf method's …
owenthcarey Nov 24, 2026
157838c
perf: whitespace split shares one-character fields and sizes a short …
owenthcarey Nov 24, 2026
6142306
perf: operator's unary and comparison functions and float's reading m…
owenthcarey Nov 24, 2026
bd25a6c
perf: compiled code calls a local list's, dict's, set's or str's fast…
owenthcarey Nov 24, 2026
934fbd7
perf: native classmethods bound to a class run through the builtin la…
owenthcarey Nov 24, 2026
25e2f1d
perf: zip_longest steps plain list and tuple cursors in place, lettin…
owenthcarey Nov 24, 2026
63ce5c3
perf: imports pool a module's names once, intern code names through a…
owenthcarey Nov 24, 2026
fceca2f
perf: compiled loops stop leaving per iteration at set algebra result…
owenthcarey Nov 24, 2026
4b784ea
perf: sorts by cmp_to_key call the comparison directly, compiled code…
owenthcarey Nov 24, 2026
748d1f3
perf: list.extend and set.update add a generator's items as they come…
owenthcarey Nov 24, 2026
385a568
perf: list(), tuple(), set() and sorted() of an enum class read its m…
owenthcarey Nov 24, 2026
cad7fb7
perf: compiled loops iterate an enum class through a lazy map over it…
owenthcarey Nov 25, 2026
64dd0e1
perf: math.prod and math.fsum fast halves, unicodedata functions as l…
owenthcarey Nov 25, 2026
5fd9363
perf: csv reader rows and their end take the reader's leaf half, and …
owenthcarey Nov 25, 2026
71e602e
perf: binascii encoders and decoders run fast halves for bytes, bytea…
owenthcarey Nov 25, 2026
6dc65b1
perf: the dict-subclass globals gate prunes dead owners from the fast…
owenthcarey Nov 25, 2026
0bea3bd
perf: property setters that check their value before storing run in p…
owenthcarey Nov 25, 2026
bb5af8c
perf: leaf evaluation admits getattr(), so a __getattr__ that delegat…
owenthcarey Nov 25, 2026
08dc5f0
perf: calling a class whose metaclass's __call__ is a builtin type ca…
owenthcarey Nov 25, 2026
85fc800
perf: item stores through a __setitem__ that only stores into a dict …
owenthcarey Nov 25, 2026
024301f
perf: x in SomeEnum and SomeEnum[name] answer natively when the metac…
owenthcarey Nov 25, 2026
3578562
perf: int and float subclass operators that keep the base's methods r…
owenthcarey Nov 25, 2026
c194c2e
perf: str(), f-strings, join and %s of str/int/float subclass instanc…
owenthcarey Nov 25, 2026
7470b67
perf: enum members hash their names in place, and member.name / membe…
owenthcarey Nov 25, 2026
7793e08
perf: array.array(typecode[, list]) builds in place, and its construc…
owenthcarey Nov 25, 2026
50a5bd1
perf: enum field reads use hashed, position-memoized dict lookups, an…
owenthcarey Nov 25, 2026
32ac937
perf: csv readers read their state at known positions, and list() of …
owenthcarey Nov 25, 2026
0f77ab9
perf: dataclasses.asdict copies trees of plain values natively
owenthcarey Nov 25, 2026
9cf2a90
perf: itertools.tee builds natively, math.comb/perm use machine ints,…
owenthcarey Nov 25, 2026
1d3e26e
perf: math.isqrt/gcd machine-int paths, and dict() of lazy pairs size…
owenthcarey Nov 25, 2026
c3ddf66
perf: WeakKeyDictionary and WeakSet lookups of identity-compared keys…
owenthcarey Nov 25, 2026
849a7b3
perf: WeakValueDictionary stores build their KeyedRef in place
owenthcarey Nov 25, 2026
04b1403
perf: threading.local stores run in compiled code, and SimpleQueue re…
owenthcarey Nov 25, 2026
a1b81aa
perf: a cycle over a plain cursor steps in place as another adapter's…
owenthcarey Nov 25, 2026
8f1eaed
perf: defaultdict misses remember the native __missing__ check per cl…
owenthcarey Nov 25, 2026
4d51e96
perf: Struct methods read _fmt by remembered position, and hashed ins…
owenthcarey Nov 25, 2026
2d6ab64
perf: random's shadow checks go by hashed names, and ContextVar.get b…
owenthcarey Nov 26, 2026
de27692
perf: set methods with set arguments run as leaves, enumerate over a …
owenthcarey Nov 26, 2026
c8adf12
perf: dict.popitem runs as a leaf, set |= set runs in compiled code, …
owenthcarey Nov 26, 2026
ea88c99
perf: bytes.join runs as a leaf, and adapter drains try only their ow…
owenthcarey Nov 26, 2026
8e59c4b
perf: heapq sifts compare and swap native scalars in place, product t…
owenthcarey Nov 26, 2026
d663ea9
perf: Counter tallies a run of plain keys under one view, and zip's b…
owenthcarey Nov 26, 2026
831eaed
perf: list() of a user iterable drains its native iterator in place, …
owenthcarey Nov 26, 2026
b60fd36
perf: bytes and bytearray methods over plain operands run as leaves
owenthcarey Nov 26, 2026
2477fd4
perf: BytesIO getvalue and in-place writes read the buffer through views
owenthcarey Nov 26, 2026
df4d823
perf: map over an instance with a native __call__ drains through its …
owenthcarey Nov 26, 2026
ff70489
docs: record the set, enumerate, map, heapq, Counter, bytes and Bytes…
owenthcarey Nov 26, 2026
6a85647
perf: list(enumerate(gen)) collects the generator as list(gen) does, …
owenthcarey Nov 26, 2026
140a5cf
perf: list() of an adapter over a generator skips the pure step it ca…
owenthcarey Nov 26, 2026
64fea55
perf: sum, min, max, any, all, list and tuple reach their interpreter…
owenthcarey Nov 26, 2026
12b9db4
perf: class attributes read through instances hit the class memo in t…
owenthcarey Nov 26, 2026
b9ef0fa
perf: methods, staticmethods and classmethods read through instances …
owenthcarey Nov 26, 2026
97d3e0c
perf: core container constructors skip the struct-sequence scan, bool…
owenthcarey Nov 26, 2026
9bf1723
perf: list.index with int start and stop bounds scans natively, and r…
owenthcarey Nov 26, 2026
34bc5ac
perf: deque iterators drain at once and step as leaves, deque.extend …
owenthcarey Nov 26, 2026
c6cc40d
perf: key in ChainMap is decided in place over exact dicts, and chain…
owenthcarey Nov 26, 2026
7f5c191
perf: functools.update_wrapper runs natively for two plain functions,…
owenthcarey Nov 26, 2026
6f9be15
perf: exhausted list iterators share one empty store, the frame JIT r…
owenthcarey Nov 26, 2026
7a5177c
perf: enumerate over a native adapter feeds the fused pair step, spre…
owenthcarey Nov 26, 2026
69b927f
perf: getattr, hasattr and attrgetter read __slots__ members directly…
owenthcarey Nov 26, 2026
5a08f57
perf: the instance getattr memo keeps plain words keyed by class vers…
owenthcarey Nov 26, 2026
3cb3c45
perf: legacy __getitem__ iteration steps the sequence's __getitem__ f…
owenthcarey Nov 26, 2026
c956417
perf: frameless evaluations read __slots__ members without the interp…
owenthcarey Nov 26, 2026
aba2b9a
perf: a pure __getattr__ hook is found once per class version, and a …
owenthcarey Nov 26, 2026
a9fce9c
perf: a leaf plan's call of the builtin hash on one natively hashable…
owenthcarey Nov 26, 2026
e99df14
perf: list(g) of a groupby group over a plain cursor drains the group…
owenthcarey Nov 26, 2026
a14f10b
perf: descending ranges step in place in both compiled tiers, and fra…
owenthcarey Nov 26, 2026
e969e8b
perf: a pure-leaf __format__ runs frameless for format() and f-string…
owenthcarey Nov 26, 2026
9819294
perf: round, pow, repr, hex, oct and bin count as pure in frameless e…
owenthcarey Nov 27, 2026
57349a9
fix: a frameless evaluation's subscript of a container it built holds…
owenthcarey Nov 27, 2026
a7f1f6a
perf: opaque str methods and bytes fast halves count as pure in frame…
owenthcarey Nov 27, 2026
50efd2a
perf: zip's bulk drain builds rows of four to eight items straight in…
owenthcarey Nov 27, 2026
5bf6232
perf: draining a chain drains a generator source whole, as list(gen) …
owenthcarey Nov 27, 2026
44837a4
perf: draining an islice over a generator steps the generator in a row
owenthcarey Nov 27, 2026
00743b3
perf: draining a zip over generators steps each row's sources in order
owenthcarey Nov 27, 2026
b3aa1dc
perf: compiled subscripts raise a sequence's IndexError in place
owenthcarey Nov 27, 2026
fca6236
perf: int and float methods that read their receiver count as pure in…
owenthcarey Nov 27, 2026
876d74d
perf: activations an exception unwinds reuse the shells and locals th…
owenthcarey Nov 27, 2026
cf609fa
perf: compiled loops over filter(None, gen) step the generator in place
owenthcarey Nov 27, 2026
aaa1465
perf: compiled attribute stores call a Python __setattr__ or setter d…
owenthcarey Nov 27, 2026
d0efbc2
perf: compiled item stores call a Python __setitem__ directly
owenthcarey Nov 27, 2026
32a3208
perf: compiled truth tests call a Python __bool__ or __len__ directly
owenthcarey Nov 27, 2026
ed4d225
perf: compiled in tests and item deletions call Python __contains__ a…
owenthcarey Nov 27, 2026
a5d304c
perf: compiled len(obj) calls a Python __len__ directly
owenthcarey Nov 27, 2026
9287090
perf: compiled stores through a data descriptor's Python __set__ call…
owenthcarey Nov 27, 2026
7ab83e5
perf: compiled augmented assignments call a Python in-place method di…
owenthcarey Nov 27, 2026
f7b566f
perf: compiled set.add hashes an instance key with its frameless __ha…
owenthcarey Nov 27, 2026
2714d44
perf: compiled dict.get hashes an instance key with its frameless __h…
owenthcarey Nov 27, 2026
f895b81
perf: compiled f-string fields call a Python __format__ directly
owenthcarey Nov 27, 2026
3399c9b
perf: compiled str(obj) calls a Python __str__ directly
owenthcarey Nov 27, 2026
fd4c258
perf: stack-receiver attribute reads try the site's __getattr__ memo …
owenthcarey Nov 27, 2026
fa64abb
perf: a bytes iterator feeding native adapters steps in place
owenthcarey Nov 27, 2026
84e3c8c
perf: a callable instance as an adapter's callback is called as its m…
owenthcarey Nov 27, 2026
51bc55d
perf: compiled repr(obj) and !r/!s conversions call a Python __repr__…
owenthcarey Nov 27, 2026
b978d28
perf: membership tests and dict.get settle an equal instance key with…
owenthcarey Nov 27, 2026
98e3b51
perf: a bare-%s template over plain instances renders in one pass
owenthcarey Nov 28, 2026
c83cf62
perf: compiled d[k] reads an instance key with its frameless __hash__
owenthcarey Nov 28, 2026
2b1c539
perf: str(obj) of a repr-only class calls its Python __repr__ directly
owenthcarey Nov 28, 2026
f81bd6f
perf: a methodcaller calls a Python method directly
owenthcarey Nov 28, 2026
9f69aaf
perf: a compiled loop that stores a fresh pair whole refills the last…
owenthcarey Nov 30, 2026
dd51832
perf: a compiled d[i] missing an int key raises its KeyError in compi…
owenthcarey Nov 30, 2026
adc9e29
perf: a tier-2 comparison no Python code answers skips the guard recheck
owenthcarey Nov 30, 2026
8c6d088
perf: a keyword call of a **kwargs function appends each keyword unpr…
owenthcarey Nov 30, 2026
faaaab4
perf: a tier-2 type(x) reads the class off the borrowed operand
owenthcarey Nov 30, 2026
3b34470
perf: a deferred container's registration reaps its dead predecessors…
owenthcarey Nov 30, 2026
c5e421b
perf: a construction whose __init__ needs its own frame skips the fra…
owenthcarey Nov 30, 2026
1cb2c64
test: the many-parameters timing check allows the arm64 runners' spread
owenthcarey Nov 30, 2026
b9a5ebd
perf: a tier-2 len() of a deque reads the length by its direct operation
owenthcarey Nov 30, 2026
3d59e40
perf: a compiled leaf builtin call leaves its bound-method scratch un…
owenthcarey Nov 30, 2026
2daeec0
perf: str(obj) of a plain class's instance skips the number and enum …
owenthcarey Nov 30, 2026
8c97e3a
perf: compiled str(), repr() and len() evaluate a warm pure-leaf dund…
owenthcarey Nov 30, 2026
d19a2eb
perf: every enum-member text check skips the verdict for a plain class
owenthcarey Nov 30, 2026
a09b34d
perf: compiled unary operators and abs() call a class's Python dunder…
owenthcarey Nov 30, 2026
7721d2a
perf: compiled iter(obj) calls a class's Python __iter__ directly
owenthcarey Nov 30, 2026
b5b1995
perf: compiled n <op> obj calls the instance's Python reflected metho…
owenthcarey Nov 30, 2026
7eebf55
perf: the enum-member text check skips a class whose metaclass is typ…
owenthcarey Nov 30, 2026
3af09b5
perf: compiled format(obj) calls the __str__ object.__format__ would
owenthcarey Nov 30, 2026
68c2095
perf: an effect leaf's read of an attribute it stored answers from th…
owenthcarey Nov 30, 2026
f3a42f4
perf: namedtuple repr formats natively; compiled hash(obj) calls __ha…
owenthcarey Nov 30, 2026
75bc99c
perf: frameless leaf evaluations format strings with % and repeat the…
owenthcarey Nov 30, 2026
04df4da
perf: frameless leaf evaluations run f-strings
owenthcarey Nov 30, 2026
d696d82
perf: a frameless f-string joins all its pieces at once
owenthcarey Nov 30, 2026
986567a
perf: an instance's membership test asks for its cached Python __cont…
owenthcarey Nov 30, 2026
ce6d5fe
perf: frameless leaf evaluations run !r/!s conversions and tuple unpa…
owenthcarey Nov 30, 2026
959a8b5
perf: a fresh generator whose prologue no fast step runs declines its…
owenthcarey Dec 1, 2026
1d44dd4
perf: frameless leaf evaluations run computed slices and dict literals
owenthcarey Dec 1, 2026
c8afed8
perf: frameless leaf evaluations build list literals and tuples past …
owenthcarey Dec 1, 2026
c875dd9
perf: leaf sequences gather items in a plain loop; an f-string's !r p…
owenthcarey Dec 1, 2026
6b6f378
perf: a builtin method called through its type skips the receiver che…
owenthcarey Dec 1, 2026
fee8223
perf: an instance's Python __index__ is found through its class's cac…
owenthcarey Dec 1, 2026
3f9b812
perf: binary operators outside compiled code call the one Python meth…
owenthcarey Dec 1, 2026
40401c9
perf: effect leaves store into dicts and lists
owenthcarey Dec 1, 2026
f602554
perf: a pure-leaf callback takes its trailing defaults in place
owenthcarey Dec 1, 2026
7097fd0
perf: dunder calls bind leaf defaults; round(obj) calls the class's c…
owenthcarey Dec 1, 2026
e1e6ebc
perf: a compiled leaf plan's isinstance(x, C) goes straight to the check
owenthcarey Dec 1, 2026
edfe2a0
perf: list() of a range's iterator builds the rest of its ints at once
owenthcarey Dec 1, 2026
b51a289
perf: a property setter's store site remembers the setter under the c…
owenthcarey Dec 1, 2026
994c811
perf: a __getattr__ site probes only the instance under a vouched cla…
owenthcarey Dec 1, 2026
f18af9a
perf: leaf plans read len() in line; min/max compare plain keys natively
owenthcarey Dec 1, 2026
0336490
perf: a native call lane unwraps a partial of its builtin and runs th…
owenthcarey Dec 1, 2026
3ec8f12
perf: any/all step native adapters directly; ASCII case predicates; s…
owenthcarey Dec 1, 2026
2737514
perf: leaf comparison methods from native code; attrgetter sort keys;…
owenthcarey Dec 1, 2026
be7b148
perf: leaf plans compare two instances by their comparison method as …
owenthcarey Dec 1, 2026
bb4816a
perf: del of a bytearray index in compiled code; splitlines skips lin…
owenthcarey Dec 1, 2026
8d56fa3
perf: sorting by a lambda that reads one part of each item takes the …
owenthcarey Dec 1, 2026
1a6016a
perf: f(*args) of a warm leaf evaluates in place; leaf len() without …
owenthcarey Dec 2, 2026
a54e258
perf: the weak reference epoch is one process-wide atomic instead of …
owenthcarey Dec 2, 2026
876c94a
perf: native adapters read a one-part lambda's part directly
owenthcarey Dec 2, 2026
dc21053
perf: islice, chain, count and cycle step in one helper; zip_longest,…
owenthcarey Dec 2, 2026
be32ecf
perf: heapq compares tuple entries in place
owenthcarey Dec 2, 2026
61e48ae
perf: tier 2 leaves pointer-chasing loops to the frame JIT
owenthcarey Dec 2, 2026
84b94cb
perf: accumulate runs a pure callback in place
owenthcarey Dec 2, 2026
2428b92
perf: deque iteration, list(d), x in d and construction take native l…
owenthcarey Dec 2, 2026
9aa4fd4
perf: dict subclass subscripts take tuple keys and temporary keys in …
owenthcarey Dec 2, 2026
f18233a
perf: dict subclasses iterate, collect, merge, copy and compare natively
owenthcarey Dec 2, 2026
c79153f
perf: OrderedDict stores take tuple and temporary keys in place; od.c…
owenthcarey Dec 2, 2026
ab068ad
perf: list, tuple, set and dict subclasses compare as their payloads;…
owenthcarey Dec 2, 2026
e25b540
fix: the compiler's free-name memo keeps only the compiled tree's own…
owenthcarey Dec 2, 2026
6cffade
perf: named tuples hash and compare natively as dict keys; truth test…
owenthcarey Dec 2, 2026
584ee02
perf: array loops read the buffer in place; namespace probes and stor…
owenthcarey Dec 2, 2026
d77e816
perf: datetime.time is built, hashed, compared and formatted natively…
owenthcarey Dec 2, 2026
9d0fc41
perf: OrderedDict loops build their iterator in place; array methods …
owenthcarey Dec 2, 2026
7000234
fix: tier 2 hands back an attribute read whose value has a finalizer …
owenthcarey Dec 2, 2026
12a30e5
perf: outside module stores rebind in place; frame-blind natives run …
owenthcarey Dec 2, 2026
f305255
perf: leaf functions with **kwargs take the direct call; list and tup…
owenthcarey Dec 2, 2026
5ce8615
perf: generators resume by a short path where they have resumed befor…
owenthcarey Dec 2, 2026
9823978
perf: ElementTree loops and iterators step in compiled code; find, fi…
owenthcarey Dec 2, 2026
9212ac3
perf: zoneinfo-aware datetimes are built, compared, shifted, hashed a…
owenthcarey Dec 2, 2026
e2cd962
perf: codecs.lookup remembers each spelling's codec; nineteen more fr…
owenthcarey Dec 2, 2026
3fbc6b0
perf: builtins reach datetime and Decimal comparison, arithmetic, has…
owenthcarey Dec 2, 2026
c457467
perf: a dict subclass built from a dict copies its table whole; decim…
owenthcarey Dec 2, 2026
9c153a5
perf: value subclasses compare, hash and convert as their payloads; a…
owenthcarey Dec 3, 2026
662e100
perf: weakref callbacks run with the dispatch loop quiet; WeakSet.add…
owenthcarey Dec 3, 2026
ccbcfb5
perf: a class store that changes nothing keeps the class's version, a…
owenthcarey Dec 3, 2026
bcbbd91
perf: match statements, global stores and empty unpacks run in compil…
owenthcarey Dec 3, 2026
5fdb07d
perf: decimal contexts are built, stored to, copied, cleared and inst…
owenthcarey Dec 3, 2026
174add1
perf: the remaining Decimal methods run natively (next_plus, next_tow…
owenthcarey Dec 3, 2026
1865431
perf: compiled callbacks read globals in line for any function over t…
owenthcarey Dec 3, 2026
2ebdec9
perf: map, filter and key functions read an operator getter's part wi…
owenthcarey Dec 3, 2026
1513f99
perf: set displays add an unpacked list's items in one pass, truth te…
owenthcarey Dec 3, 2026
47512ca
perf: sequences by __getitem__ are iterated by a native step and buil…
owenthcarey Dec 3, 2026
8c6fe22
perf: a Mapping that only wraps a dict is copied, merged, spread and …
owenthcarey Dec 3, 2026
9f629aa
perf: callbacks with defaults or keyword-only parameters bind in plac…
owenthcarey Dec 3, 2026
14877c3
perf: a generator body that unpacks its items takes the in-place resu…
owenthcarey Dec 3, 2026
40aa5e1
perf: a missing attribute on a built-in subclass's instance is one ve…
owenthcarey Dec 3, 2026
fc1eea1
perf: errors from built-in methods, number operators, len(), next() a…
owenthcarey Dec 4, 2026
9ccf15b
perf: an exception leaving a callee that compiled code entered direct…
owenthcarey Dec 4, 2026
cc31bba
perf: an except clause that can't observe its exception (no binding, …
owenthcarey Dec 4, 2026
38a6558
perf: an attribute site keeps a few classes' field and __slots__ posi…
owenthcarey Dec 4, 2026
f187643
perf: map(), filter(), sorted() and max() call a warm Python leaf cal…
owenthcarey Dec 4, 2026
9632815
perf: a functools.partial of a warm Python leaf called with keywords …
owenthcarey Dec 4, 2026
0b06f7c
perf: a keyword call of a builtin method whose keywords name the para…
owenthcarey Dec 4, 2026
0303808
perf: {**d, "k": v} puts the listed pairs straight into the merged di…
owenthcarey Dec 4, 2026
c30dc15
perf: exponent-form float formatting takes exact digits from 128-bit …
owenthcarey Dec 4, 2026
e921207
perf: s.replace of one ASCII character by another copies the text onc…
owenthcarey Dec 4, 2026
e7728a4
perf: integer arithmetic past 64 bits whose operands and result fit 1…
owenthcarey Dec 4, 2026
69d9a20
perf: the interpreter's fused pure call checks the whole argument run…
owenthcarey Dec 4, 2026
9b01401
perf: tier 2 builds an instance whose __init__ only stores its parame…
owenthcarey Dec 4, 2026
bbcf055
perf: the frame JIT builds a dict display whose instance keys have pu…
owenthcarey Dec 4, 2026
0bc05c6
perf: in-memory streams make their descriptor lock at first use, keep…
owenthcarey Dec 4, 2026
ce9ca9e
perf: list(struct.iter_unpack()) reads every chunk in one pass; typed…
owenthcarey Dec 4, 2026
7b97982
perf: unicodedata.normalize and is_normalized answer CPython's quick …
owenthcarey Dec 4, 2026
2955795
perf: compiled reads of a builtin container's protocol dunders (d.__g…
owenthcarey Dec 4, 2026
73d5177
perf: it.__next__() of a native iterator, map, filter, zip or exact i…
owenthcarey Dec 5, 2026
27682ea
perf: next(it) and it.__next__() of a native iterator step it in plac…
owenthcarey Dec 5, 2026
9df73b3
perf: OrderedDict(d) of an exact dict copies its table whole for payl…
owenthcarey Dec 5, 2026
7a6b399
perf: a builtin with a native half mapped or used as a sort key over …
owenthcarey Dec 5, 2026
5fedafc
perf: a leaf plan comparing two tuples of one to three items it just …
owenthcarey Dec 5, 2026
b6a5dd1
perf: heapq.heappush/heappop have native halves compiled code calls i…
owenthcarey Dec 5, 2026
30b78fe
perf: compiled code enters a class whose __init__ runs in a frame as …
owenthcarey Dec 5, 2026
67fe2d2
perf: module bodies compile (LOAD_NAME/STORE_NAME as global loads and…
owenthcarey Dec 5, 2026
585cbf3
perf: in-line field stores skip the write barrier for every atomic ta…
owenthcarey Dec 5, 2026
7ef590d
perf: blind except clauses may add, subtract or multiply ints or floa…
owenthcarey Dec 5, 2026
73f2e6e
perf: a finished call releases its argument cells in one pass over it…
owenthcarey Dec 5, 2026
a325705
perf: in an inlined body, a global read an attribute read follows (St…
owenthcarey Dec 5, 2026
05a5a9d
perf: a loop whose only Python calls are small pure leaves counts as …
owenthcarey Dec 5, 2026
547972d
perf: os.DirEntry's is_dir/is_file/is_symlink/inode have fast halves …
owenthcarey Dec 5, 2026
f3871fe
perf: code generation reads operands from a flat use list liveness bu…
owenthcarey Dec 5, 2026
e0cf1e0
perf: instance attribute lookups by name (the leaf read's split-dict …
owenthcarey Dec 5, 2026
ba96eea
perf: compiled property reads on slotted classes call the cached gett…
owenthcarey Dec 5, 2026
575280d
perf: a class attribute holding a module is a class memo compiled cod…
owenthcarey Dec 5, 2026
66479b5
perf: iter(callable, sentinel) returns a native callable_iterator wit…
owenthcarey Dec 5, 2026
c2c1f67
perf: __import__ of an already-imported module is answered in place b…
owenthcarey Dec 6, 2026
a49541d
perf: threading.local reads in compiled code call the native __getatt…
owenthcarey Dec 6, 2026
fbdeb31
perf: pairwise over a plain cursor builds each pair in place, its fir…
owenthcarey Dec 6, 2026
38aa45c
perf: for loops over csv.reader keep the reader and step it in place,…
owenthcarey Dec 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ jobs:
shell: bash
run: |
rustc -vV | sed -n 's/^release: /rustc /p'
cat target/release/deps/weavepy-*.order-note 2>/dev/null || echo "no order note"
# (Cargo 1.100 links the binary under build/<pkg>/<hash>/out/,
# earlier cargos under deps/.)
notes=$(find target/release/deps target/release/build -name 'weavepy*.order-note' 2>/dev/null || true)
if [ -n "$notes" ]; then cat $notes; else echo "no order note"; fi
- name: Build merge-base weavepy (A/B reference)
if: github.event_name == 'pull_request'
# A separate worktree + target dir so the two builds never
Expand Down Expand Up @@ -284,6 +287,23 @@ jobs:
name: cold-jit-diagnostic-${{ matrix.os }}
path: target/performance/cold-jit-ci/${{ github.run_id }}-${{ github.run_attempt }}/
if-no-files-found: warn
# Where a flagged fixture's time went: each tier setting's kernel
# time and, on macOS, instructions and cycles, for both binaries
# (see tools/bench_gate_counts.py). Equal counts with unequal times
# are the runner or the code's layout; unequal counts name a tier.
- name: Count instructions for the fixtures a failed gate flagged
if: failure() && matrix.os != 'windows-latest' && github.event_name == 'pull_request' && steps.bench_gate.outcome == 'failure'
timeout-minutes: 10
shell: bash
run: |
python tools/bench_gate_counts.py \
--base "$BASE_WEAVEPY" --new target/release/weavepy \
--report bench-report.md | tee bench-gate-counts.md
{
echo "## Flagged fixtures by tier setting"
echo
cat bench-gate-counts.md
} >> "$GITHUB_STEP_SUMMARY"
- name: Append bench report to job summary
if: always()
shell: bash
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ memchr = "2.8"
libc = "0.2"
libmimalloc-sys = { version = "0.1.49", default-features = false }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
# rustls's crypto provider; `hashlib` takes its SHA-256, SHA-384 and SHA-512.
ring = { version = "0.17", default-features = false }
rustls-pki-types = "1.7"
# PKCS#8 "ENCRYPTED PRIVATE KEY" (PBES2) decryption for password-protected
# keys in SSLContext.load_cert_chain.
Expand Down
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ are how it measures progress.
| --- | --- | --- |
| CPython test suite | 464 of 468 `Lib/test` entries pass | November 2, 2026, on macOS |
| Real packages | 48 of 48 install and pass a behavior check | September 2026, on macOS and Linux; kept in CI |
| Warm speed | 0.85 times CPython's time | November 13, 2026, over 33 workloads |
| Peak memory | 1.14 times CPython's resident set, 1.22 times its footprint | November 13, 2026, over 33 workloads |
| Everyday library code | 1.44 times CPython's time | November 13, 2026, over 54 short loops |
| Warm speed | 0.84 times CPython's time | November 15, 2026, over 33 workloads |
| Peak memory | 1.13 times CPython's resident set | November 15, 2026, over 33 workloads |
| Everyday library code | 1.23 times CPython's time | November 15, 2026, over 54 short loops |

The sections below explain what these numbers cover and where they fall short.

Expand Down Expand Up @@ -128,15 +128,19 @@ small fraction of CPython's instructions, while `zip`, `Enum` lookups, dict
copies and calls through `*args` still take one and a half to two and a half
times as many. The [progress note](docs/PERFORMANCE-PROGRESS.md) lists them.

Ordinary library-heavy code is where WeavePy is behind. A battery of 54
everyday operations (`tools/pybench/everyday.py`: file and directory work,
text, data formats, classes, threads, common modules) runs at 1.44 times
CPython's time on average (1.79 before the work that followed its first run).
WeavePy is ahead on 12 of the 54 and past twice CPython's time on 14, with
thread queues, `inspect` and `typing`, `weakref`, class-protocol code, and
`enum` with `dataclasses` between 3 and 4 times. File and stream I/O, which was
far slower still (a line read took a system call per byte), is now level with
CPython or ahead of it. The rest is the current work.
Ordinary library-heavy code was where WeavePy was furthest behind, and is now
about level. A battery of 54 everyday operations (`tools/pybench/everyday.py`:
file and directory work, text, data formats, classes, threads, common modules)
runs at 0.97 times CPython's time on average, measured on November 19, 2026, at
`c69d14ad` (1.79 when the battery was first run, 1.26 four days earlier).
WeavePy is ahead on 28 of the 54 and past one and a half times CPython's time
on 5: `threading_queue_ops` (2.2), `argparse_ops` (1.9), `inspect_typing_ops`
(1.7), `email_html_ops` (1.6) and `exceptions_ops` (1.5). Those are short runs
of standard-library code that end before the JIT has warmed up, and threads:
starting one costs three times what it does in CPython. File and stream I/O,
which was far slower still (a line read took a system call per byte), is now
level with CPython or ahead of it, as are `datetime`, `re` and `json`. The rest
is the current work.

Code that the JIT compiles fully can run far faster. The numeric loops in the
[bench gate fixtures](docs/PERFORMANCE-CPYTHON-PARITY.md) took 5% to 8% of
Expand Down Expand Up @@ -164,6 +168,12 @@ measurements and the work behind them.
code pages a program is done with once its imports are over; a plain
release build does that only in processes that run for more than a tenth
of a second.
- **Threads.** Starting and joining a thread takes about twice CPython's
time, and so does handing items to freshly started workers through a
`queue.Queue`. On Windows a second thread, even an idle one, still turns
reference counts atomic and cell borrows locked, which costs object-heavy
code 12% to 30%; elsewhere both stay plain under the GIL and an idle thread
costs nothing measurable.
- **Imports and warm-up.** Importing large parts of the standard library costs
about 1.4 times CPython's instructions; a faster start-up hides most of it
in short scripts. Cold time is a little under CPython's overall, but some
Expand Down
77 changes: 58 additions & 19 deletions crates/weavepy-bench/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,21 @@ fn runset(samples: &[Sample]) -> RunSet {
}

/// Time a single fixture under the PR binary *and* a merge-base
/// binary, interleaving the legs sample by sample (PR, base, CPython,
/// PR, base, CPython, …) so slow drift on a shared runner — thermal
/// ramp, a neighbor tenant spinning up — lands on both legs equally
/// and cancels in the PR/base ratio. This is what makes the A/B gate
/// immune to the machine skew that a committed-baseline comparison
/// spends its whole envelope absorbing.
/// binary, interleaving the legs round by round so slow drift on a
/// shared runner — thermal ramp, a neighbor tenant spinning up — lands
/// on both legs equally and cancels in the PR/base ratio. This is what
/// makes the A/B gate immune to the machine skew that a
/// committed-baseline comparison spends its whole envelope absorbing.
///
/// Within a round the two binaries run in a balanced order (PR, base,
/// base, PR, then CPython; the next round base, PR, PR, base), two
/// samples each. A fixed PR, base, CPython order put every PR sample
/// right after another program's run and every base sample right after
/// a near-identical one's, so whatever a leg inherits from the process
/// before it (shared cache and page-cache state, the frozen code
/// cache's files) favored the base: a PR that changed no code could
/// fail the gate. Balanced, each binary follows the other program, the
/// other binary and itself equally often.
///
/// A base-leg failure is not an error: a fixture added by the PR
/// under test may exercise syntax the merge-base binary cannot run
Expand All @@ -183,24 +192,27 @@ pub fn run_one_ab(
} else {
opts.samples
};
let mut pr_samples = Vec::with_capacity(opts.samples as usize);
let mut base_samples = Vec::with_capacity(opts.samples as usize);
let mut pr_samples = Vec::with_capacity(2 * opts.samples as usize);
let mut base_samples = Vec::with_capacity(2 * opts.samples as usize);
let mut py_samples = Vec::with_capacity(opts.samples as usize);
let mut base_ok = true;
for i in 0..runs {
let keep = !opts.warmup || i > 0;
let pr = time_subprocess(weavepy.as_os_str(), fix, &[])?;
if keep {
pr_samples.push(pr);
}
if base_ok {
match time_subprocess(base.as_os_str(), fix, &[]) {
Ok(b) => {
if keep {
base_samples.push(b);
for is_pr in ab_order(i) {
if is_pr {
let pr = time_subprocess(weavepy.as_os_str(), fix, &[])?;
if keep {
pr_samples.push(pr);
}
} else if base_ok {
match time_subprocess(base.as_os_str(), fix, &[]) {
Ok(b) => {
if keep {
base_samples.push(b);
}
}
Err(_) => base_ok = false,
}
Err(_) => base_ok = false,
}
}
if let Some(py) = python {
Expand All @@ -222,6 +234,14 @@ pub fn run_one_ab(
.with_base(base_set))
}

/// The order of round `round`'s four A/B legs (`true` the PR binary's):
/// PR, base, base, PR on even rounds and its mirror on odd ones (see
/// [`run_one_ab`]).
fn ab_order(round: u32) -> [bool; 4] {
let pr_first = round.is_multiple_of(2);
[pr_first, !pr_first, !pr_first, pr_first]
}

/// Run all known fixtures A/B (see [`run_one_ab`]) and return one
/// [`Row`] per fixture.
pub fn run_suite_ab(opts: &RunOpts, base: &Path) -> io::Result<Vec<Row>> {
Expand Down Expand Up @@ -854,7 +874,26 @@ fn demangle_rust(sym: &str) -> String {

#[cfg(test)]
mod tests {
use super::{demangle_rust, median, parse_bench_ns, parse_sample_output, ScalingRow};
use super::{ab_order, demangle_rust, median, parse_bench_ns, parse_sample_output, ScalingRow};

/// Over any two consecutive rounds each binary runs four times, and
/// each is once the leg right after the CPython leg (a round's first)
/// and once the leg right before it (its last).
#[test]
fn ab_order_is_balanced() {
for start in 0..4u32 {
let rounds = [ab_order(start), ab_order(start + 1)];
let pr = rounds.iter().flatten().filter(|&&is_pr| is_pr).count();
assert_eq!(pr, 4);
assert_ne!(rounds[0][0], rounds[1][0]);
assert_ne!(rounds[0][3], rounds[1][3]);
for r in rounds {
assert_eq!(r[0], r[3]);
assert_eq!(r[1], r[2]);
assert_ne!(r[0], r[1]);
}
}
}

#[test]
fn demangles_legacy_rust_symbols() {
Expand Down
16 changes: 11 additions & 5 deletions crates/weavepy-capi/src/abstract_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3652,11 +3652,17 @@ pub unsafe extern "C" fn PySequence_Check(o: *mut PyObject) -> c_int {
// raise "Could not convert object to sequence". A foreign sequence
// that really has `sq_item` (numpy's `_array_converter`) returns 1
// at the C-slot check above and never reaches here.
if matches!(
inst.cls().lookup("__getitem__"),
Some(Object::Function(_) | Object::BoundMethod(_))
) {
return 1;
match inst.cls().lookup("__getitem__") {
Some(Object::Function(_) | Object::BoundMethod(_)) => return 1,
// A class written in Python whose `__getitem__` is served
// natively and that declares itself a sequence
// (`Py_TPFLAGS_SEQUENCE`: `array.array`, whose C type in
// CPython has `sq_item`): Pillow's `putdata(array(...))`
// asks exactly this.
Some(Object::Builtin(_)) if inst.cls().collection_flags() & (1 << 5) != 0 => {
return 1
}
_ => {}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/weavepy-capi/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ fn describe_native_export(obj: &Object) -> Result<NativeExport, ()> {
let base_ptr = memoryview_backing_ptr(&mv.buffer);
let ptr = unsafe { base_ptr.add(start) };
let itemsize = mv.itemsize.get().max(1);
let format = mv.format.borrow().clone().into_bytes();
let format = mv.format.borrow().as_bytes().to_vec();
// Element shape/stride: honour an explicit shape, else derive a
// 1-D `[len / itemsize]` C-contiguous layout. This is what keeps
// a typed view's `itemsize`/`format` self-consistent with the
Expand Down
17 changes: 17 additions & 0 deletions crates/weavepy-capi/src/force_link_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,23 @@ static FORCE_LINK: &[FnPtr] = &[
addr!(strings::PyByteArray_Resize),
addr!(strings::PyUnicode_DecodeASCII),
addr!(strings::PyUnicode_DecodeLatin1),
addr!(strings::PyUnicode_DecodeUTF16),
addr!(strings::PyUnicode_DecodeUTF16Stateful),
addr!(strings::PyUnicode_DecodeUTF32),
addr!(strings::PyUnicode_DecodeUTF32Stateful),
addr!(strings::PyUnicode_DecodeUTF7),
addr!(strings::PyUnicode_DecodeUTF7Stateful),
addr!(strings::PyUnicode_DecodeUnicodeEscape),
addr!(strings::PyUnicode_DecodeRawUnicodeEscape),
addr!(strings::PyUnicode_AsUTF16String),
addr!(strings::PyUnicode_AsUTF32String),
addr!(strings::PyUnicode_AsUnicodeEscapeString),
addr!(strings::PyUnicode_AsRawUnicodeEscapeString),
addr!(strings::PyUnicode_GetDefaultEncoding),
addr!(strings::PyUnicode_AsWideChar),
addr!(strings::PyUnicode_AsWideCharString),
addr!(strings::PyUnicode_FSConverter),
addr!(strings::PyUnicode_FSDecoder),
addr!(strings::PyUnicode_DecodeFSDefault),
addr!(strings::PyUnicode_DecodeFSDefaultAndSize),
addr!(strings::PyUnicode_EncodeFSDefault),
Expand Down
2 changes: 2 additions & 0 deletions crates/weavepy-capi/src/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ pub unsafe extern "C" fn PyEval_SaveThread() -> *mut PyThreadState {
// represent the token as the count of guards we just
// popped, encoded into the pointer. Anything non-null
// restores; null means "we weren't holding the GIL".
weavepy_vm::gil::before_gil_release();
let popped = pop_gil_guard();
if popped.is_some() {
// Encode "1 guard popped" as a dangling sentinel; the
Expand Down Expand Up @@ -256,5 +257,6 @@ pub unsafe extern "C" fn PyEval_AcquireThread(_state: *mut PyThreadState) {
#[no_mangle]
pub unsafe extern "C" fn PyEval_ReleaseThread(_state: *mut PyThreadState) {
// Paired with `PyEval_AcquireThread`.
weavepy_vm::gil::before_gil_release();
let _ = pop_gil_guard();
}
8 changes: 4 additions & 4 deletions crates/weavepy-capi/src/memoryview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ pub unsafe extern "C" fn PyMemoryView_FromObjectAndFlags(
len: Cell::new(view_len),
readonly: Cell::new(readonly),
released: Cell::new(false),
format: RefCell::new(format),
format: RefCell::new(format.into()),
itemsize: Cell::new(view_itemsize),
shape: RefCell::new(shape),
strides: RefCell::new(strides),
Expand Down Expand Up @@ -497,7 +497,7 @@ pub unsafe extern "C" fn PyMemoryView_FromBuffer(view: *const Py_buffer) -> *mut
len: Cell::new(len),
readonly: Cell::new(readonly),
released: Cell::new(false),
format: RefCell::new(format),
format: RefCell::new(format.into()),
itemsize: Cell::new(itemsize),
shape: RefCell::new(shape),
strides: RefCell::new(strides),
Expand Down Expand Up @@ -590,7 +590,7 @@ pub unsafe extern "C" fn PyMemoryView_GetContiguous(
MemoryViewBuffer::Bytes(out.into()),
total * itemsize,
true,
mv.format.borrow().clone(),
mv.format.borrow().to_string(),
itemsize,
);
if ndim >= 1 {
Expand Down Expand Up @@ -648,7 +648,7 @@ pub unsafe extern "C" fn PyMemoryView_GET_BUFFER(mv: *mut PyObject) -> *mut Py_b
(p, Some(buf_box))
}
};
let format = view.format.borrow().clone() + "\0";
let format = view.format.borrow().to_string() + "\0";
let format_storage: Box<[u8]> = format.into_bytes().into_boxed_slice();
let itemsize = view.itemsize.get().max(1);

Expand Down
Loading
Loading