Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
marshal: add final validation section + raw perf data folder
Appends to Misc/marshal-perf-diary.md the results of the full test
suite rerun (48,932 tests pass, including the new RecursiveGraphTest
combinatoric cases) and a `pyperformance` comparison against main on
the same 10-benchmark marshal-adjacent slice the design doc used.

Significant results on the pyperformance slice:

    python_startup          1.18x faster (t=59.80)
    python_startup_no_site  1.03x faster (t=12.90)

All other slice benchmarks within noise; no regressions.

Adds Misc/marshal-perf-data/ with the raw JSON backing every table in
the diary: all per-experiment microbench runs (exp0..exp9, expC, final)
plus the two pyperf-slice JSONs and a README describing the layout and
reproduction commands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
  • Loading branch information
mjbommar and claude committed Apr 17, 2026
commit e931b7ec45c21048389b4235d44a6220ceb9bdfc
53 changes: 53 additions & 0 deletions Misc/marshal-perf-data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Marshal Perf Raw Data

Raw JSON artifacts backing `Misc/marshal-perf-diary.md`. Everything here
is regeneratable — kept checked in so reviewers can inspect numbers
without rerunning the full methodology.

## Marshal microbench (`marshal_bench_cpu_stable.py`)

Three pinned runs per commit, 11 repeats per operation, 200k `loads` ×
100k `dumps`. Pinning: `taskset -c 0`.

| File | Commit / idea |
| --- | --- |
| `exp0-run{1..3}.json` | `perf-baseline` self-check at `eb1c4b7` |
| `exp1-run{1..3}.json` | Experiment 1 (raw `PyObject **` refs array) |
| `exp2-run{1..3}.json` | Experiment 2 (tagged pointer state, stacked on 1) |
| `exp3-run{1..3}.json` | Experiment 3 (collapse reserve+publish) |
| `exp4-run{1..3}.json` | Experiment 4 (`has_incomplete` counter) |
| `exp5-run{1..3}.json` | Experiment 5 (zero-init + drop mark_ready) |
| `exp6-run{1..3}.json` | Experiment 6 (drop `allow_incomplete_hashable` param) |
| `exp7-run{1..3}.json` | Experiment 7 (force-inline helpers) |
| `exp8-run{1..3}.json` | Experiment 8 (`frozendict`-then-wrap when `flag==0`) |
| `exp9-run{1..3}.json` | Experiment 9 (preallocate refs capacity) |
| `expC-run{1..3}.json` | Combined (Exp 1+2+6+7) on `exp/combined-winners` |
| `final-head-run{1..3}.json` | Post-squash HEAD `4aaf064344d` (same as Combined) |

Schema per bench (small_tuple / nested_dict / code_obj):

loads_number, dumps_number # inner loop counts
loads_runs: [11 times] # raw timings
dumps_runs: [11 times]
loads_min, loads_median # statistics
dumps_min, dumps_median

## pyperformance slice

Ten marshal-adjacent benchmarks (pickle × 4, unpickle × 3,
python_startup × 2, unpack_sequence). Run with `uvx pyperformance run
-b <list> --affinity 0` via `taskset -c 0`.

| File | Python |
| --- | --- |
| `pyperf-slice-baseline.json` | `main` tip `2faceeec` built at `/tmp/cpython-baseline/python` |
| `pyperf-slice-current.json` | HEAD `4aaf064344d` built in-tree |

These are standard `pyperf` format; compare with:

uvx pyperformance compare pyperf-slice-baseline.json pyperf-slice-current.json

## Regeneration

See `Misc/marshal-perf-diary.md` → "Ground rules" for the exact harness
(`/tmp/marshal_bench_cpu_stable.py` inline script) and methodology.
104 changes: 104 additions & 0 deletions Misc/marshal-perf-data/exp0-run1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"code_obj": {
"dumps_median": 0.040405122010270134,
"dumps_min": 0.039836373005528,
"dumps_number": 100000,
"dumps_runs": [
0.040096846991218626,
0.04028077999828383,
0.04065272197476588,
0.04065836101653986,
0.04028131702216342,
0.040413388021988794,
0.039836373005528,
0.04000361601356417,
0.04100019999896176,
0.040806725999573246,
0.040405122010270134
],
"loads_median": 0.09791472702636383,
"loads_min": 0.09674789398559369,
"loads_number": 200000,
"loads_runs": [
0.09674789398559369,
0.09708369200234301,
0.09783264898578636,
0.09744057801435702,
0.09815629699733108,
0.09906345797935501,
0.09835395799018443,
0.09974412800511345,
0.09990381199168041,
0.09737725998274982,
0.09791472702636383
]
},
"nested_dict": {
"dumps_median": 0.07455040101194754,
"dumps_min": 0.07420829197508283,
"dumps_number": 100000,
"dumps_runs": [
0.07494553699507378,
0.07451574600418098,
0.07446633197832853,
0.07566936200601049,
0.07430389401270077,
0.07455040101194754,
0.07424808200448751,
0.07420829197508283,
0.07491164302336983,
0.07538196400855668,
0.0746764489740599
],
"loads_median": 0.08682646200759336,
"loads_min": 0.08603669900912791,
"loads_number": 200000,
"loads_runs": [
0.08728363699628972,
0.08605418298975565,
0.08732464100467041,
0.08639801701065153,
0.08744612199370749,
0.08878127401112579,
0.08682646200759336,
0.08644566498696804,
0.08648836001520976,
0.08734603400807828,
0.08603669900912791
]
},
"small_tuple": {
"dumps_median": 0.0156986290239729,
"dumps_min": 0.01551589198061265,
"dumps_number": 100000,
"dumps_runs": [
0.015826012007892132,
0.015661484998418018,
0.01551589198061265,
0.01563638899824582,
0.0156986290239729,
0.015819393011042848,
0.01584347800235264,
0.01551837200531736,
0.015644578001229092,
0.01609343197196722,
0.01589953200891614
],
"loads_median": 0.032818893989315256,
"loads_min": 0.032478501991136,
"loads_number": 200000,
"loads_runs": [
0.039915669010952115,
0.034840578999137506,
0.032818893989315256,
0.032755594002082944,
0.032478501991136,
0.03285682899877429,
0.032941445999313146,
0.03272099400055595,
0.032805391994770616,
0.0325985630042851,
0.032910926995100453
]
}
}
104 changes: 104 additions & 0 deletions Misc/marshal-perf-data/exp0-run2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"code_obj": {
"dumps_median": 0.039624935016036034,
"dumps_min": 0.03912865900201723,
"dumps_number": 100000,
"dumps_runs": [
0.04005826299544424,
0.039624935016036034,
0.03912865900201723,
0.03937379698618315,
0.03985618698061444,
0.0396080739737954,
0.03980735401273705,
0.039562535006552935,
0.03952119100722484,
0.04000154402456246,
0.03970523300813511
],
"loads_median": 0.09828513601678424,
"loads_min": 0.0965760959952604,
"loads_number": 200000,
"loads_runs": [
0.09915574299520813,
0.0985370319976937,
0.0965760959952604,
0.09828084200853482,
0.097619662003126,
0.10028967598918825,
0.0983922420127783,
0.0987230259925127,
0.09828513601678424,
0.09821752097923309,
0.09726348100230098
]
},
"nested_dict": {
"dumps_median": 0.07583842999883927,
"dumps_min": 0.07371149398386478,
"dumps_number": 100000,
"dumps_runs": [
0.07573145598871633,
0.07466877298429608,
0.07562672600033693,
0.07371149398386478,
0.07529966699075885,
0.07686721297795884,
0.07583842999883927,
0.0770502710074652,
0.076849859993672,
0.07778827799484134,
0.07668794898199849
],
"loads_median": 0.08660990899079479,
"loads_min": 0.0859223100123927,
"loads_number": 200000,
"loads_runs": [
0.08658557198941708,
0.08649306499864906,
0.08618080499581993,
0.0874386359937489,
0.08762964798370376,
0.0859223100123927,
0.0869109459745232,
0.0878543850267306,
0.08672871999442577,
0.08612436000839807,
0.08660990899079479
]
},
"small_tuple": {
"dumps_median": 0.015691205015173182,
"dumps_min": 0.015531735989497975,
"dumps_number": 100000,
"dumps_runs": [
0.015568955015623942,
0.015662263002013788,
0.01571622901246883,
0.015571760974125937,
0.015531735989497975,
0.01582504398538731,
0.01576065199333243,
0.015691205015173182,
0.015571972995530814,
0.015708502003690228,
0.015745237993542105
],
"loads_median": 0.03315894500701688,
"loads_min": 0.03273815900320187,
"loads_number": 200000,
"loads_runs": [
0.036090038978727534,
0.03278564300853759,
0.03315894500701688,
0.03321557000163011,
0.032992702996125445,
0.0333719459886197,
0.03368866798700765,
0.03273815900320187,
0.03284121898468584,
0.03342736198101193,
0.032767266005976126
]
}
}
104 changes: 104 additions & 0 deletions Misc/marshal-perf-data/exp0-run3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"code_obj": {
"dumps_median": 0.04041685801348649,
"dumps_min": 0.03987288600183092,
"dumps_number": 100000,
"dumps_runs": [
0.040255115018226206,
0.040099431993439794,
0.04095420497469604,
0.03987288600183092,
0.04041685801348649,
0.040494924993254244,
0.04049262698390521,
0.04079927600105293,
0.04118377499980852,
0.04038904799381271,
0.04038159898482263
],
"loads_median": 0.09712665400002152,
"loads_min": 0.09544071301934309,
"loads_number": 200000,
"loads_runs": [
0.09710476599866524,
0.09544071301934309,
0.09796852199360728,
0.09641282400116324,
0.09771751399966888,
0.09875676699448377,
0.09825973899569362,
0.09712665400002152,
0.09814226999878883,
0.09603261601296254,
0.0969423119968269
]
},
"nested_dict": {
"dumps_median": 0.07670464701368473,
"dumps_min": 0.07443057300406508,
"dumps_number": 100000,
"dumps_runs": [
0.07670464701368473,
0.0755682380113285,
0.07518417699611746,
0.07505606301128864,
0.07443057300406508,
0.07728818198665977,
0.07829541899263859,
0.07810401200549677,
0.07622043599258177,
0.07752709698979743,
0.07774014701135457
],
"loads_median": 0.08734592801192775,
"loads_min": 0.08589171001221985,
"loads_number": 200000,
"loads_runs": [
0.08709321398055181,
0.08734592801192775,
0.08714917601901107,
0.08695745901786722,
0.08589171001221985,
0.08879310198244639,
0.08659902500221506,
0.08748295900295489,
0.08759746799478307,
0.08768528798827901,
0.08783682601642795
]
},
"small_tuple": {
"dumps_median": 0.01571595700806938,
"dumps_min": 0.015293899981770664,
"dumps_number": 100000,
"dumps_runs": [
0.01571595700806938,
0.015348431013990194,
0.015293899981770664,
0.015364045015303418,
0.01530077401548624,
0.015608929010340944,
0.015807940013473853,
0.01611778000369668,
0.01599793799687177,
0.01602914900286123,
0.016072057012934238
],
"loads_median": 0.03303753398358822,
"loads_min": 0.032468440011143684,
"loads_number": 200000,
"loads_runs": [
0.036123027006397024,
0.03290336497593671,
0.032468440011143684,
0.032748425990575925,
0.03303753398358822,
0.033069997996790335,
0.03337217401713133,
0.03351389098679647,
0.033144343993626535,
0.03277306197560392,
0.03264542398392223
]
}
}
Loading
Loading