diff options
| author | eunhhu <[email protected]> | 2026-10-05 09:29:23 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-05 09:29:23 +0100 |
| commit | 58b8d5b291422a0c12db590eefbad6efe96cc6de (patch) | |
| tree | 3ea6eda47b9dc06269325c226f4c79c9df549035 /research | |
| parent | 2654f58ae6a7d0fcaf356b0f4cd69038b3eaf00c (diff) | |
| download | pure-58b8d5b291422a0c12db590eefbad6efe96cc6de.tar.gz pure-58b8d5b291422a0c12db590eefbad6efe96cc6de.zip | |
Design 022: stored lists as arrays with a bucket index fitted to the keys searched, narrow columns, a JIT with registers and loop guards, read ahead; criteria first
Diffstat (limited to 'research')
6 files changed, 283 insertions, 7 deletions
diff --git a/research/experiments/038-past-c/2026-10-05-bfsfloor-alone.jsonl b/research/experiments/038-past-c/2026-10-05-bfsfloor-alone.jsonl new file mode 100644 index 0000000..bb9184e --- /dev/null +++ b/research/experiments/038-past-c/2026-10-05-bfsfloor-alone.jsonl @@ -0,0 +1,90 @@ +{"round":1,"form":"c","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":9.513,"instructions":9930943,"cycles":22598532,"branch_misses":232710,"l1d_misses":1187985,"llc_misses":196358,"work":0} +{"round":1,"form":"c","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":9.565,"instructions":9930943,"cycles":22670765,"branch_misses":234181,"l1d_misses":1187951,"llc_misses":198661,"work":0} +{"round":1,"form":"c","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":9.718,"instructions":9930952,"cycles":23008498,"branch_misses":233813,"l1d_misses":1187712,"llc_misses":202749,"work":0} +{"round":1,"form":"c","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":9.554,"instructions":9930943,"cycles":22859537,"branch_misses":233719,"l1d_misses":1187927,"llc_misses":200955,"work":0} +{"round":1,"form":"c","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":9.539,"instructions":9930943,"cycles":22553554,"branch_misses":233414,"l1d_misses":1187573,"llc_misses":194217,"work":0} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"c","repeats":21,"ms":9.554} +{"round":1,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":8.817,"instructions":21699678,"cycles":21004428,"branch_misses":199079,"l1d_misses":260581,"llc_misses":181738,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":9.733,"instructions":21699665,"cycles":23218621,"branch_misses":199749,"l1d_misses":261098,"llc_misses":228940,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":8.659,"instructions":21699677,"cycles":20732537,"branch_misses":198820,"l1d_misses":261142,"llc_misses":180357,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":8.581,"instructions":21699678,"cycles":20528115,"branch_misses":199833,"l1d_misses":261042,"llc_misses":182243,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":8.624,"instructions":21699665,"cycles":20600968,"branch_misses":198858,"l1d_misses":261003,"llc_misses":182276,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"narrow_ahead","repeats":21,"ms":8.659} +{"round":1,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":13.030,"instructions":18500082,"cycles":30950785,"branch_misses":202914,"l1d_misses":451526,"llc_misses":202269,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":12.863,"instructions":18500082,"cycles":30655768,"branch_misses":202792,"l1d_misses":451289,"llc_misses":208734,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":12.742,"instructions":18500082,"cycles":30374858,"branch_misses":203016,"l1d_misses":451339,"llc_misses":203187,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":13.044,"instructions":18500082,"cycles":31090887,"branch_misses":202424,"l1d_misses":450780,"llc_misses":214310,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":12.989,"instructions":18500082,"cycles":30974267,"branch_misses":201566,"l1d_misses":450965,"llc_misses":206665,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"narrow","repeats":21,"ms":12.989} +{"round":1,"form":"c_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":8.275,"instructions":11430806,"cycles":19794774,"branch_misses":230406,"l1d_misses":1004009,"llc_misses":208953,"work":0} +{"round":1,"form":"c_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":7.229,"instructions":11430802,"cycles":17279604,"branch_misses":229142,"l1d_misses":1004017,"llc_misses":163048,"work":0} +{"round":1,"form":"c_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":7.046,"instructions":11430805,"cycles":16841813,"branch_misses":229592,"l1d_misses":1003342,"llc_misses":161580,"work":0} +{"round":1,"form":"c_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":6.927,"instructions":11430806,"cycles":16571742,"branch_misses":229156,"l1d_misses":1004417,"llc_misses":159956,"work":0} +{"round":1,"form":"c_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":7.062,"instructions":11430802,"cycles":16893106,"branch_misses":229101,"l1d_misses":1003035,"llc_misses":162452,"work":0} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"c_ahead","repeats":21,"ms":7.062} +{"round":1,"form":"packed","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":23.061,"instructions":29099302,"cycles":55201608,"branch_misses":197608,"l1d_misses":687725,"llc_misses":1305567,"work":25997969} +{"round":1,"form":"packed","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":23.290,"instructions":29099302,"cycles":55607437,"branch_misses":198034,"l1d_misses":689132,"llc_misses":1336320,"work":25997969} +{"round":1,"form":"packed","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":23.338,"instructions":29099302,"cycles":55872039,"branch_misses":197556,"l1d_misses":689395,"llc_misses":1332969,"work":25997969} +{"round":1,"form":"packed","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":23.121,"instructions":29099302,"cycles":55355022,"branch_misses":197373,"l1d_misses":688049,"llc_misses":1320484,"work":25997969} +{"round":1,"form":"packed","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":23.270,"instructions":29099302,"cycles":55705797,"branch_misses":197835,"l1d_misses":688876,"llc_misses":1335114,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"packed","repeats":21,"ms":23.270} +{"round":2,"form":"c","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":9.400,"instructions":9930943,"cycles":22506822,"branch_misses":233025,"l1d_misses":1188085,"llc_misses":195810,"work":0} +{"round":2,"form":"c","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":9.403,"instructions":9930943,"cycles":22528937,"branch_misses":233643,"l1d_misses":1187672,"llc_misses":194342,"work":0} +{"round":2,"form":"c","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":9.466,"instructions":9930943,"cycles":22661529,"branch_misses":232683,"l1d_misses":1187331,"llc_misses":196380,"work":0} +{"round":2,"form":"c","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":9.419,"instructions":9930943,"cycles":22559271,"branch_misses":232371,"l1d_misses":1188099,"llc_misses":197534,"work":0} +{"round":2,"form":"c","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":9.445,"instructions":9930943,"cycles":22602658,"branch_misses":232462,"l1d_misses":1187435,"llc_misses":197496,"work":0} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"c","repeats":21,"ms":9.419} +{"round":2,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":8.377,"instructions":21699678,"cycles":20030629,"branch_misses":199233,"l1d_misses":260968,"llc_misses":212794,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":8.227,"instructions":21699665,"cycles":19695643,"branch_misses":198840,"l1d_misses":261373,"llc_misses":198694,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":8.256,"instructions":21699677,"cycles":19738860,"branch_misses":198911,"l1d_misses":261620,"llc_misses":215820,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":8.140,"instructions":21699678,"cycles":19478025,"branch_misses":199386,"l1d_misses":261655,"llc_misses":214376,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":8.415,"instructions":21699665,"cycles":20141577,"branch_misses":199145,"l1d_misses":261729,"llc_misses":193454,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"narrow_ahead","repeats":21,"ms":8.256} +{"round":2,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":12.727,"instructions":18500082,"cycles":30459303,"branch_misses":201994,"l1d_misses":449993,"llc_misses":198517,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":12.877,"instructions":18500082,"cycles":30821271,"branch_misses":202540,"l1d_misses":450914,"llc_misses":203192,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":12.835,"instructions":18500082,"cycles":30713044,"branch_misses":201373,"l1d_misses":451893,"llc_misses":211620,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":12.764,"instructions":18500082,"cycles":30566444,"branch_misses":202280,"l1d_misses":451611,"llc_misses":212361,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":12.709,"instructions":18500082,"cycles":30427138,"branch_misses":201013,"l1d_misses":450824,"llc_misses":196344,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"narrow","repeats":21,"ms":12.764} +{"round":2,"form":"c_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":7.068,"instructions":11430806,"cycles":16899365,"branch_misses":229151,"l1d_misses":1003197,"llc_misses":160489,"work":0} +{"round":2,"form":"c_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":7.076,"instructions":11430802,"cycles":16929953,"branch_misses":228509,"l1d_misses":1003466,"llc_misses":160852,"work":0} +{"round":2,"form":"c_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":7.096,"instructions":11430805,"cycles":16961974,"branch_misses":228595,"l1d_misses":1003014,"llc_misses":161011,"work":0} +{"round":2,"form":"c_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":7.015,"instructions":11430806,"cycles":16812937,"branch_misses":228759,"l1d_misses":1003284,"llc_misses":164448,"work":0} +{"round":2,"form":"c_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":7.072,"instructions":11430802,"cycles":16926924,"branch_misses":228107,"l1d_misses":1002726,"llc_misses":162025,"work":0} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"c_ahead","repeats":21,"ms":7.072} +{"round":2,"form":"packed","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":22.935,"instructions":29099302,"cycles":54793228,"branch_misses":197473,"l1d_misses":688741,"llc_misses":1309254,"work":25997969} +{"round":2,"form":"packed","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":23.190,"instructions":29099302,"cycles":55462573,"branch_misses":197823,"l1d_misses":689011,"llc_misses":1310105,"work":25997969} +{"round":2,"form":"packed","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":23.117,"instructions":29099302,"cycles":55307475,"branch_misses":197318,"l1d_misses":689038,"llc_misses":1323771,"work":25997969} +{"round":2,"form":"packed","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":23.097,"instructions":29099302,"cycles":55243920,"branch_misses":197550,"l1d_misses":688837,"llc_misses":1328834,"work":25997969} +{"round":2,"form":"packed","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":23.070,"instructions":29099302,"cycles":55192732,"branch_misses":197511,"l1d_misses":689825,"llc_misses":1318476,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"packed","repeats":21,"ms":23.097} +{"round":3,"form":"c","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":9.561,"instructions":9930943,"cycles":22869778,"branch_misses":232056,"l1d_misses":1187795,"llc_misses":201837,"work":0} +{"round":3,"form":"c","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":9.399,"instructions":9930943,"cycles":22515873,"branch_misses":233065,"l1d_misses":1187347,"llc_misses":193257,"work":0} +{"round":3,"form":"c","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":9.478,"instructions":9930943,"cycles":22685088,"branch_misses":233836,"l1d_misses":1187285,"llc_misses":196028,"work":0} +{"round":3,"form":"c","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":10.649,"instructions":9930943,"cycles":25453339,"branch_misses":232241,"l1d_misses":1187986,"llc_misses":225063,"work":0} +{"round":3,"form":"c","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":10.434,"instructions":9930943,"cycles":24926258,"branch_misses":235525,"l1d_misses":1187296,"llc_misses":219938,"work":0} +{"round":3,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"c","repeats":21,"ms":9.561} +{"round":3,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":8.704,"instructions":21699678,"cycles":20826385,"branch_misses":199729,"l1d_misses":260554,"llc_misses":175494,"work":25997969} +{"round":3,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":8.587,"instructions":21699665,"cycles":20528294,"branch_misses":199793,"l1d_misses":260696,"llc_misses":166850,"work":25997969} +{"round":3,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":8.513,"instructions":21699677,"cycles":20343356,"branch_misses":199186,"l1d_misses":260809,"llc_misses":174411,"work":25997969} +{"round":3,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":8.489,"instructions":21699678,"cycles":20177155,"branch_misses":199960,"l1d_misses":261075,"llc_misses":171650,"work":25997969} +{"round":3,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":8.709,"instructions":21699665,"cycles":20834469,"branch_misses":199518,"l1d_misses":261196,"llc_misses":178564,"work":25997969} +{"round":3,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"narrow_ahead","repeats":21,"ms":8.587} +{"round":3,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":12.884,"instructions":18500082,"cycles":30836152,"branch_misses":202254,"l1d_misses":450594,"llc_misses":202869,"work":25997969} +{"round":3,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":12.682,"instructions":18500082,"cycles":30361751,"branch_misses":202749,"l1d_misses":450622,"llc_misses":195885,"work":25997969} +{"round":3,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":12.634,"instructions":18500082,"cycles":30238142,"branch_misses":202097,"l1d_misses":451561,"llc_misses":205780,"work":25997969} +{"round":3,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":12.818,"instructions":18500082,"cycles":30671583,"branch_misses":203287,"l1d_misses":450962,"llc_misses":215803,"work":25997969} +{"round":3,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":13.016,"instructions":18500082,"cycles":31146316,"branch_misses":202002,"l1d_misses":451624,"llc_misses":203457,"work":25997969} +{"round":3,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"narrow","repeats":21,"ms":12.818} +{"round":3,"form":"c_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":7.084,"instructions":11430806,"cycles":16863699,"branch_misses":229370,"l1d_misses":1003166,"llc_misses":157948,"work":0} +{"round":3,"form":"c_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":7.130,"instructions":11430802,"cycles":17055170,"branch_misses":229565,"l1d_misses":1003293,"llc_misses":160637,"work":0} +{"round":3,"form":"c_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":7.164,"instructions":11430805,"cycles":17142965,"branch_misses":229413,"l1d_misses":1002475,"llc_misses":160694,"work":0} +{"round":3,"form":"c_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":7.212,"instructions":11430806,"cycles":17243238,"branch_misses":229890,"l1d_misses":1003238,"llc_misses":168980,"work":0} +{"round":3,"form":"c_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":7.112,"instructions":11430802,"cycles":17031109,"branch_misses":231057,"l1d_misses":1002241,"llc_misses":164152,"work":0} +{"round":3,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"c_ahead","repeats":21,"ms":7.130} +{"round":3,"form":"packed","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":23.279,"instructions":29099302,"cycles":55675615,"branch_misses":197454,"l1d_misses":687723,"llc_misses":1307193,"work":25997969} +{"round":3,"form":"packed","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":24.655,"instructions":29099302,"cycles":58989250,"branch_misses":197757,"l1d_misses":687057,"llc_misses":1387216,"work":25997969} +{"round":3,"form":"packed","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":23.294,"instructions":29099302,"cycles":55749704,"branch_misses":197878,"l1d_misses":688298,"llc_misses":1334566,"work":25997969} +{"round":3,"form":"packed","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":23.201,"instructions":29099302,"cycles":55325156,"branch_misses":197703,"l1d_misses":687560,"llc_misses":1312181,"work":25997969} +{"round":3,"form":"packed","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":23.398,"instructions":29099302,"cycles":55967221,"branch_misses":197362,"l1d_misses":687740,"llc_misses":1319728,"work":25997969} +{"round":3,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":8,"buckets":100001,"form":"packed","repeats":21,"ms":23.294} diff --git a/research/experiments/038-past-c/2026-10-05-bfsfloor-widths.jsonl b/research/experiments/038-past-c/2026-10-05-bfsfloor-widths.jsonl new file mode 100644 index 0000000..4c9ecfd --- /dev/null +++ b/research/experiments/038-past-c/2026-10-05-bfsfloor-widths.jsonl @@ -0,0 +1,72 @@ +{"round":1,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":9.141,"instructions":21699673,"cycles":21889648,"branch_misses":199181,"l1d_misses":267372,"llc_misses":220196,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":8.989,"instructions":21699660,"cycles":21493767,"branch_misses":199654,"l1d_misses":267544,"llc_misses":206546,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":8.942,"instructions":21699672,"cycles":21405109,"branch_misses":199483,"l1d_misses":267225,"llc_misses":210997,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":8.987,"instructions":21699673,"cycles":21494691,"branch_misses":199897,"l1d_misses":267729,"llc_misses":201553,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":9.048,"instructions":21699660,"cycles":21634990,"branch_misses":199697,"l1d_misses":267686,"llc_misses":204230,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":4,"buckets":200000,"form":"narrow_ahead","repeats":21,"ms":8.989} +{"round":1,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":14.217,"instructions":18500077,"cycles":33909488,"branch_misses":202087,"l1d_misses":459539,"llc_misses":237253,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":14.694,"instructions":18500077,"cycles":35052529,"branch_misses":201690,"l1d_misses":459959,"llc_misses":276103,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":14.480,"instructions":18500077,"cycles":34485148,"branch_misses":201833,"l1d_misses":460120,"llc_misses":245464,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":14.107,"instructions":18500077,"cycles":33771102,"branch_misses":202409,"l1d_misses":459509,"llc_misses":250968,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":14.391,"instructions":18500077,"cycles":34293784,"branch_misses":201157,"l1d_misses":458888,"llc_misses":240061,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":4,"buckets":200000,"form":"narrow","repeats":21,"ms":14.391} +{"round":1,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":22.682,"instructions":29200858,"cycles":54256857,"branch_misses":353441,"l1d_misses":603484,"llc_misses":990428,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":22.681,"instructions":29200845,"cycles":54278547,"branch_misses":355841,"l1d_misses":603398,"llc_misses":976943,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":22.463,"instructions":29200857,"cycles":53613082,"branch_misses":354707,"l1d_misses":603279,"llc_misses":944855,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":22.693,"instructions":29200858,"cycles":53903702,"branch_misses":354467,"l1d_misses":604035,"llc_misses":973959,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":22.518,"instructions":29200845,"cycles":53796436,"branch_misses":354967,"l1d_misses":603733,"llc_misses":964239,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":16,"buckets":50001,"form":"narrow_ahead","repeats":21,"ms":22.681} +{"round":1,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":24.475,"instructions":26051261,"cycles":58191307,"branch_misses":352289,"l1d_misses":770035,"llc_misses":1369292,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":24.432,"instructions":26051261,"cycles":58186826,"branch_misses":353073,"l1d_misses":770364,"llc_misses":1377296,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":24.378,"instructions":26051261,"cycles":58052564,"branch_misses":352589,"l1d_misses":769361,"llc_misses":1367396,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":24.410,"instructions":26051261,"cycles":58172465,"branch_misses":352699,"l1d_misses":770080,"llc_misses":1383195,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":24.468,"instructions":26051270,"cycles":58150327,"branch_misses":352355,"l1d_misses":769709,"llc_misses":1370533,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":16,"buckets":50001,"form":"narrow","repeats":21,"ms":24.432} +{"round":1,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":28.514,"instructions":43451487,"cycles":68021901,"branch_misses":421289,"l1d_misses":738205,"llc_misses":1611386,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":28.483,"instructions":43451474,"cycles":68012352,"branch_misses":422013,"l1d_misses":738087,"llc_misses":1618587,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":28.439,"instructions":43451486,"cycles":68048135,"branch_misses":421647,"l1d_misses":738115,"llc_misses":1612382,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":28.525,"instructions":43451487,"cycles":68186305,"branch_misses":421708,"l1d_misses":738091,"llc_misses":1626742,"work":25997969} +{"round":1,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":28.527,"instructions":43451474,"cycles":68245199,"branch_misses":420687,"l1d_misses":737900,"llc_misses":1639154,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":32,"buckets":25001,"form":"narrow_ahead","repeats":21,"ms":28.514} +{"round":1,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":29.204,"instructions":40326890,"cycles":69848162,"branch_misses":417157,"l1d_misses":855417,"llc_misses":1641359,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":29.117,"instructions":40326890,"cycles":69599234,"branch_misses":417124,"l1d_misses":855262,"llc_misses":1641321,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":29.200,"instructions":40326890,"cycles":69839219,"branch_misses":416421,"l1d_misses":854422,"llc_misses":1636540,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":29.223,"instructions":40326890,"cycles":69809540,"branch_misses":417208,"l1d_misses":855215,"llc_misses":1644333,"work":25997969} +{"round":1,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":29.220,"instructions":40326890,"cycles":69916157,"branch_misses":416893,"l1d_misses":855647,"llc_misses":1637894,"work":25997969} +{"round":1,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":32,"buckets":25001,"form":"narrow","repeats":21,"ms":29.204} +{"round":2,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":9.098,"instructions":21699673,"cycles":21501837,"branch_misses":199083,"l1d_misses":268164,"llc_misses":205057,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":9.257,"instructions":21699660,"cycles":22120034,"branch_misses":199754,"l1d_misses":267603,"llc_misses":210308,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":8.939,"instructions":21699672,"cycles":21365285,"branch_misses":199381,"l1d_misses":268043,"llc_misses":206258,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":9.117,"instructions":21699673,"cycles":21512945,"branch_misses":199911,"l1d_misses":267651,"llc_misses":200324,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":9.035,"instructions":21699660,"cycles":21502008,"branch_misses":199438,"l1d_misses":268038,"llc_misses":201463,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":4,"buckets":200000,"form":"narrow_ahead","repeats":21,"ms":9.098} +{"round":2,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":14.304,"instructions":18500077,"cycles":34222206,"branch_misses":201504,"l1d_misses":459182,"llc_misses":238512,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":14.569,"instructions":18500077,"cycles":34847617,"branch_misses":202727,"l1d_misses":459735,"llc_misses":251855,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":14.279,"instructions":18500077,"cycles":34190176,"branch_misses":202471,"l1d_misses":459866,"llc_misses":243387,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":14.387,"instructions":18500077,"cycles":34427255,"branch_misses":201743,"l1d_misses":459728,"llc_misses":248537,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":14.350,"instructions":18500077,"cycles":34340800,"branch_misses":201236,"l1d_misses":459056,"llc_misses":240549,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":4,"buckets":200000,"form":"narrow","repeats":21,"ms":14.350} +{"round":2,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":22.226,"instructions":29200858,"cycles":53186143,"branch_misses":353023,"l1d_misses":603444,"llc_misses":960547,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":22.397,"instructions":29200845,"cycles":53517742,"branch_misses":354791,"l1d_misses":604220,"llc_misses":965447,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":22.299,"instructions":29200857,"cycles":53369938,"branch_misses":354043,"l1d_misses":602959,"llc_misses":945884,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":22.300,"instructions":29200858,"cycles":53399189,"branch_misses":355720,"l1d_misses":602978,"llc_misses":946992,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":22.262,"instructions":29200845,"cycles":53183522,"branch_misses":353366,"l1d_misses":603661,"llc_misses":951593,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":16,"buckets":50001,"form":"narrow_ahead","repeats":21,"ms":22.299} +{"round":2,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":24.029,"instructions":26051261,"cycles":57535579,"branch_misses":351591,"l1d_misses":769557,"llc_misses":1367134,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":24.056,"instructions":26051261,"cycles":57563063,"branch_misses":352716,"l1d_misses":770798,"llc_misses":1372321,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":24.191,"instructions":26051261,"cycles":57830356,"branch_misses":352389,"l1d_misses":770219,"llc_misses":1380059,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":24.088,"instructions":26051261,"cycles":57588541,"branch_misses":352538,"l1d_misses":769364,"llc_misses":1366742,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":24.114,"instructions":26051261,"cycles":57742013,"branch_misses":353706,"l1d_misses":770238,"llc_misses":1374648,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":16,"buckets":50001,"form":"narrow","repeats":21,"ms":24.088} +{"round":2,"form":"narrow_ahead","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":28.492,"instructions":43451487,"cycles":68182052,"branch_misses":421258,"l1d_misses":738346,"llc_misses":1619135,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":28.397,"instructions":43451474,"cycles":67945428,"branch_misses":421760,"l1d_misses":738141,"llc_misses":1605562,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":28.474,"instructions":43451486,"cycles":68126834,"branch_misses":420689,"l1d_misses":738043,"llc_misses":1615468,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":28.518,"instructions":43451487,"cycles":68224496,"branch_misses":421860,"l1d_misses":738253,"llc_misses":1620473,"work":25997969} +{"round":2,"form":"narrow_ahead","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":28.485,"instructions":43451474,"cycles":68139426,"branch_misses":421137,"l1d_misses":738001,"llc_misses":1618049,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":32,"buckets":25001,"form":"narrow_ahead","repeats":21,"ms":28.485} +{"round":2,"form":"narrow","alone":true,"from":7767,"to":34553,"hops":5,"reached":99998,"ms":29.317,"instructions":40326890,"cycles":69762016,"branch_misses":418898,"l1d_misses":854959,"llc_misses":1660842,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":18342,"to":39241,"hops":6,"reached":99998,"ms":29.242,"instructions":40326890,"cycles":69886668,"branch_misses":418494,"l1d_misses":854763,"llc_misses":1671153,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":73728,"to":40868,"hops":6,"reached":99998,"ms":29.266,"instructions":40326890,"cycles":69403555,"branch_misses":417917,"l1d_misses":854101,"llc_misses":1635658,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":75932,"to":66396,"hops":6,"reached":99998,"ms":29.173,"instructions":40326890,"cycles":69719398,"branch_misses":418633,"l1d_misses":854243,"llc_misses":1659562,"work":25997969} +{"round":2,"form":"narrow","alone":true,"from":9981,"to":23853,"hops":5,"reached":99998,"ms":29.196,"instructions":40326890,"cycles":69850365,"branch_misses":418142,"l1d_misses":854961,"llc_misses":1652789,"work":25997969} +{"round":2,"nodes":100000,"edges":999937,"far":16,"near":8,"per_bucket":32,"buckets":25001,"form":"narrow","repeats":21,"ms":29.242} diff --git a/research/experiments/038-past-c/2026-10-05-roundtrip.jsonl b/research/experiments/038-past-c/2026-10-05-roundtrip.jsonl new file mode 100644 index 0000000..7175ed7 --- /dev/null +++ b/research/experiments/038-past-c/2026-10-05-roundtrip.jsonl @@ -0,0 +1,3 @@ +{"write_us": 151.2, "read_us": 80.1} +{"write_us": 150.7, "read_us": 80.1} +{"write_us": 151.0, "read_us": 80.0} diff --git a/research/experiments/038-past-c/bfsfloor.c b/research/experiments/038-past-c/bfsfloor.c index a6258a8..a74fa82 100644 --- a/research/experiments/038-past-c/bfsfloor.c +++ b/research/experiments/038-past-c/bfsfloor.c @@ -21,9 +21,13 @@ * narrow_ahead narrow, read ahead as ahead * c_ahead bfs.c read ahead as ahead (context: what C would gain) * - * bfsfloor NODES EDGES SEARCHES [FAR NEAR]: a JSON line per search and form - * (the forms in turns; the answers must agree), with this thread's counters - * (user space), then the medians. */ + * bfsfloor NODES EDGES SEARCHES [FAR NEAR [PER_BUCKET [FORM REPEATS]]]: a + * JSON line per search and form (the forms in turns; the answers must + * agree), with this thread's counters (user space), then the medians. With + * FORM, that form alone, each search REPEATS times and its median, as bfs.c + * measures (the tables stay warm). PER_BUCKET: about how many items a bucket + * (8; the width is then 2^20 keys, a node's: other widths make a slice's + * bounds fall inside buckets). */ #define _GNU_SOURCE #include <math.h> #include <stdbool.h> @@ -255,10 +259,13 @@ static Answer search_c_ahead(uint32_t s, uint32_t t) { } int main(int argc, char **argv) { - if (argc < 4) { fputs("bfsfloor NODES EDGES SEARCHES [FAR NEAR]\n", stderr); return 2; } + if (argc < 4) { fputs("bfsfloor NODES EDGES SEARCHES [FAR NEAR [PER_BUCKET [FORM REPEATS]]]\n", stderr); return 2; } n = (uint32_t)atol(argv[1]); size_t want = (size_t)atol(argv[2]), searches = (size_t)atol(argv[3]); far_ = argc > 4 ? atoi(argv[4]) : 16, near_ = argc > 5 ? atoi(argv[5]) : 8; + size_t per_bucket = argc > 6 ? (size_t)atol(argv[6]) : 8; + const char *only = argc > 7 ? argv[7] : NULL; + size_t repeats = argc > 8 ? (size_t)atol(argv[8]) : 21; /* bfs-run's graph: from and to uniform, no loops, each pair once, sorted */ uint64_t *keys = malloc(want * sizeof(*keys)); size_t count = 0; @@ -278,7 +285,7 @@ int main(int argc, char **argv) { for (size_t k = 0; k < m; ++k) edges.key[k] = (double)keys[k], edges.to[k] = (double)(keys[k] & 0xFFFFF); double span = edges.key[m - 1] - edges.key[0]; int exponent; - frexp(span / (double)(m / 8 + 1), &exponent); + frexp(span / (double)(m / per_bucket + 1), &exponent); edges.scale = ldexp(1.0, -exponent); edges.low = floor(edges.key[0] * edges.scale) / edges.scale; edges.buckets = (size_t)floor((edges.key[m - 1] - edges.low) * edges.scale) + 2; @@ -302,6 +309,40 @@ int main(int argc, char **argv) { const char *names[] = {"c", "c_bits", "packed", "ahead", "narrow", "narrow_ahead", "c_ahead"}; Answer (*forms[])(uint32_t, uint32_t) = {search_c, search_c_bits, packed_plain, packed_ahead, narrow_plain, narrow_ahead, search_c_ahead}; + if (only) { /* one form, each search repeated: the median run's line */ + int f = 0; + while (f < FORMS && strcmp(names[f], only)) ++f; + if (f == FORMS) { fprintf(stderr, "no form %s\n", only); return 2; } + double *each = malloc(searches * sizeof(double)); + typedef struct { double ms; uint64_t c[COUNTERS]; Answer got; } Run; + Run *runs = malloc(repeats * sizeof(*runs)); + for (size_t r = 0; r < searches; ++r) { + uint32_t s = (uint32_t)(next() % n), t = (uint32_t)(next() % n); + for (size_t k = 0; k < repeats; ++k) { + uint64_t c0[COUNTERS], c1[COUNTERS]; + counters_read(c0); + double a = now(); + runs[k].got = forms[f](s, t); + runs[k].ms = now() - a; + counters_read(c1); + for (int i = 0; i < COUNTERS; ++i) runs[k].c[i] = c1[i] - c0[i]; + } + for (size_t i = 1; i < repeats; ++i) /* by time, few: insertion */ + for (size_t j = i; j > 0 && runs[j].ms < runs[j - 1].ms; --j) { Run x = runs[j]; runs[j] = runs[j - 1]; runs[j - 1] = x; } + Run *mid = &runs[repeats / 2]; + each[r] = mid->ms; + printf("{\"form\":\"%s\",\"alone\":true,\"from\":%u,\"to\":%u,\"hops\":%d,\"reached\":%u,\"ms\":%.3f," + "\"instructions\":%llu,\"cycles\":%llu,\"branch_misses\":%llu,\"l1d_misses\":%llu,\"llc_misses\":%llu," + "\"work\":%llu}\n", names[f], s, t, mid->got.hops, mid->got.reached, mid->ms, (unsigned long long)mid->c[0], + (unsigned long long)mid->c[1], (unsigned long long)mid->c[2], (unsigned long long)mid->c[3], + (unsigned long long)mid->c[4], (unsigned long long)mid->got.work); + } + qsort(each, searches, sizeof(double), by_num); + printf("{\"nodes\":%u,\"edges\":%u,\"far\":%d,\"near\":%d,\"per_bucket\":%zu,\"buckets\":%zu,\"form\":\"%s\"," + "\"repeats\":%zu,\"ms\":%.3f}\n", n, m, far_, near_, per_bucket, edges.buckets, names[f], repeats, + each[searches / 2]); + return 0; + } double *took[FORMS]; for (int f = 0; f < FORMS; ++f) took[f] = malloc(searches * sizeof(double)); for (size_t r = 0; r < searches; ++r) { @@ -324,7 +365,8 @@ int main(int argc, char **argv) { (unsigned long long)got.work); } } - printf("{\"nodes\":%u,\"edges\":%u,\"far\":%d,\"near\":%d", n, m, far_, near_); + printf("{\"nodes\":%u,\"edges\":%u,\"far\":%d,\"near\":%d,\"per_bucket\":%zu,\"buckets\":%zu", n, m, far_, near_, + per_bucket, edges.buckets); for (int f = 0; f < FORMS; ++f) { qsort(took[f], searches, sizeof(double), by_num); printf(",\"%s_ms\":%.3f", names[f], took[f][searches / 2]); diff --git a/research/experiments/038-past-c/roundtrip.py b/research/experiments/038-past-c/roundtrip.py new file mode 100644 index 0000000..53bc251 --- /dev/null +++ b/research/experiments/038-past-c/roundtrip.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +"""What HTTP adds to an event (docs/design/022): pure-serve (store in RAM, +cores 0-2) with a module, a write that does almost nothing (POST +/inputs/size of 033's graph.aup) and a read (GET /views/far), each 2,000 +times from one connection; the medians in microseconds. + +roundtrip.py PURE_SERVE MODULE (run the client apart: taskset -c 3)""" +import http.client +import json +import statistics +import subprocess +import sys +import tempfile +import time + +serve, module = sys.argv[1], sys.argv[2] +with tempfile.TemporaryDirectory() as work: + host = subprocess.Popen(['taskset', '-c', '0-2', serve, '--module', module, '--store', work + '/store', '--port', '0'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + port = json.loads(host.stdout.readline())['port'] + connection = http.client.HTTPConnection('127.0.0.1', port, timeout=60) + + def request(method, path): + connection.request(method, path, b'', {'Content-Length': '0'}) + answer = connection.getresponse() + answer.read() + assert answer.status == 200, (path, answer.status) + + out = {} + for name, (method, path) in {'write_us': ('POST', '/inputs/size?nodes=100000'), 'read_us': ('GET', '/views/far')}.items(): + took = [] + for _ in range(2000): + began = time.perf_counter() + request(method, path) + took.append((time.perf_counter() - began) * 1e6) + out[name] = round(statistics.median(took), 1) + host.terminate() + host.communicate(timeout=30) + print(json.dumps(out)) diff --git a/research/experiments/038-past-c/runs.sh b/research/experiments/038-past-c/runs.sh index 3da6196..05d301e 100644 --- a/research/experiments/038-past-c/runs.sh +++ b/research/experiments/038-past-c/runs.sh @@ -13,6 +13,12 @@ # without (PURE_JIT=0), in turns # runs.sh bfs NAME 033's bfs.py on that build (100,000 nodes, # 1,000,000 edges, 5 searches, 3 rounds) +# runs.sh floor bfsfloor's forms in turns (9 searches) +# runs.sh alone bfsfloor's forms each alone, warm (5 +# searches of 21 runs, 3 rounds) +# runs.sh widths narrow and narrow_ahead alone with buckets +# of 4, 16 and 32 items (2 rounds) +# runs.sh roundtrip roundtrip.py on after (3 times) set -e here=research/experiments/038-past-c builds=$HOME/.cache/pure-038 @@ -70,6 +76,30 @@ bfs) until awk '{ exit !($1 < 1.5) }' /proc/loadavg; do sleep 10; done python3 research/guard.py --most 2048 -- python3 research/experiments/033-computing/bfs.py "$builds/$2/pure-serve" \ ../aup/build/aup 100000 1000000 5 3 > "$here/$day-bfs-$2.jsonl" ;; -*) echo "runs.sh build NAME COMMIT | core FIRST LAST | pairs FIRST LAST | jit FIRST LAST | counts | bfs NAME" >&2 +floor|alone|widths) + cc -O2 -std=gnu17 -o "$builds/bfsfloor" $here/bfsfloor.c -lm + floor() { python3 research/guard.py --most 1024 -- "$builds/bfsfloor" 100000 1000000 "$@"; } + case "$1" in + floor) floor 9 16 8 > "$here/$day-bfsfloor.jsonl" ;; + alone) + for round in 1 2 3; do + for form in c narrow_ahead narrow c_ahead packed; do + floor 5 16 8 8 $form 21 | sed "s/^{/{\"round\":$round,/" >> "$here/$day-bfsfloor-alone.jsonl" + done + done ;; + widths) + for round in 1 2; do + for per in 4 16 32; do + for form in narrow_ahead narrow; do + floor 5 16 8 $per $form 21 | sed "s/^{/{\"round\":$round,/" >> "$here/$day-bfsfloor-widths.jsonl" + done + done + done ;; + esac ;; +roundtrip) + for i in 1 2 3; do + taskset -c 3 python3 $here/roundtrip.py "$builds/after/pure-serve" "$builds/graph.pmod" >> "$here/$day-roundtrip.jsonl" + done ;; +*) echo "runs.sh build NAME COMMIT | core FIRST LAST | pairs FIRST LAST | jit FIRST LAST | counts | bfs NAME | floor | alone | widths | roundtrip" >&2 exit 2 ;; esac |
