Add benchmarks for Bob, Bram, Brechtje & Vicky on day 2

main^2
Bram 2025-12-03 19:58:29 +01:00
parent af6536cd94
commit 65efdbd0bd
21 changed files with 6516 additions and 114 deletions

File diff suppressed because one or more lines are too long

View File

@ -37,3 +37,9 @@ Sander uses [GHCup](https://www.haskell.org/ghcup/) at version 9.6.7. Haskell
typically opens as a REPL from which functions can be evaluated, so some
liberties are taken here. The script is reformatted in the `sander_hs/` folder
and compiled to a binary in order to approximate performance.
Vicky uses [Jupyter Notebook](https://jupyter.org/). A Notebook is difficult
to benchmark and the `*.py` exported files cannot compute properly due to
wrong ordering of function definitions and scripts. The exported script is
reformatted in the `vicky_py/` folder and run as an ordinary Python script
in order to approximate performance.

View File

@ -6,4 +6,10 @@ hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d01-p1.json \
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d01-p2.json \
--runs 100 "python day01/day01-p2.py"
# Benchmark day 2
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d02-p1.json \
--runs 100 "python day02/day02-p1.py"
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d02-p2.json \
--runs 100 "python day02/day02-p2.py"
cd ../bram/benchmarks

View File

@ -8,4 +8,8 @@ cargo build --release
hyperfine --warmup 5 --export-json ../benchmarks/data/bram-d01-100.json \
--runs 100 "for run in {1..100}; do target/release/aoc2025 1; done"
# Benchmark day 2
hyperfine --warmup 5 --export-json ../benchmarks/data/bram-d02.json \
--runs 100 "target/release/aoc2025 2"
cd ../benchmarks

View File

@ -10,4 +10,14 @@ hyperfine --warmup 5 \
--runs 100 "python 1-2.py"
cd ../
# Benchmark day 2
cd 2/
hyperfine --warmup 5 \
--export-json ../../bram/benchmarks/data/brechtje-d02-p1.json \
--runs 100 "python 2-1.py"
# hyperfine --warmup 5 \
# --export-json ../../bram/benchmarks/data/brechtje-d02-p2.json \
# --runs 100 "python 2-2.py"
cd ../
cd ../bram/benchmarks

View File

@ -17,6 +17,24 @@
],
"runs": 1
},
{
"name": "bob-d02-p1.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "bob-d02-p2.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"2-2"
],
"runs": 1
},
{
"name": "bram-d01-100.json",
"author": "Bram",
@ -27,6 +45,16 @@
],
"runs": 100
},
{
"name": "bram-d02.json",
"author": "Bram",
"lang": "Rust",
"puzzles": [
"2-1",
"2-2"
],
"runs": 1
},
{
"name": "brechtje-d01-p1.json",
"author": "Brechtje",
@ -45,6 +73,15 @@
],
"runs": 1
},
{
"name": "brechtje-d02-p1.json",
"author": "Brechtje",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "sander-d01-p1.json",
"author": "Sander",
@ -53,5 +90,32 @@
"1-1"
],
"runs": 1
},
{
"name": "vicky-d01-p1.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"1-1"
],
"runs": 1
},
{
"name": "vicky-d02-p1.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "vicky-d02-p2.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"2-2"
],
"runs": 1
}
]

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python day02/day02-p1.py",
"mean": 0.6765645741299999,
"stddev": 0.013047081521433405,
"median": 0.6763296411999999,
"user": 0.6704550699999997,
"system": 0.0033457500000000006,
"min": 0.6559922267,
"max": 0.7329195817,
"times": [
0.6721216407,
0.6837450707,
0.6612521137,
0.7061815837000001,
0.6782755407,
0.6756507177,
0.6763355687,
0.6747942667,
0.6742392807,
0.6697994717,
0.6772529837,
0.6791377247,
0.6907288917,
0.6806539377,
0.6746299437,
0.6630597017,
0.6833341667,
0.6586809947,
0.6780386567,
0.6665040597,
0.6790600897,
0.6725939877,
0.6836183607,
0.6667784267,
0.6881150217,
0.6633574487,
0.6789564937,
0.6613500027,
0.6788042957,
0.6559922267,
0.6847969757,
0.6627792757,
0.6782401647,
0.6743326107000001,
0.6649894047,
0.6789302837,
0.6733824407,
0.6910859527,
0.6631805447,
0.6774636637,
0.6636205517,
0.6766484967,
0.6645901637,
0.6870083157,
0.6716324417,
0.6737801617,
0.6596793037,
0.6751984447,
0.6685770937,
0.7028166087,
0.6623790377,
0.7329195817,
0.6604573647,
0.6654454177,
0.6786648997,
0.6839100787,
0.6742385397,
0.6809124307,
0.6721741527,
0.6876361547000001,
0.6739140267,
0.6897047877,
0.6610092357,
0.6812850487,
0.6618630357,
0.6984109777,
0.6843995077,
0.6831293417000001,
0.6755151757,
0.6954556917,
0.6838049437,
0.6854161367,
0.6644793797,
0.6815224767,
0.6598976727,
0.6771346357,
0.6650421847,
0.6763237137,
0.6841810567,
0.6584676787,
0.6775632687,
0.6646109447,
0.6766417327,
0.6934756047,
0.6619941597,
0.7224684777,
0.6683667787,
0.6757852777,
0.6846177207,
0.6634212887000001,
0.6667221867,
0.6629606137,
0.6946760817000001,
0.6825597837,
0.6883855197000001,
0.6802924857,
0.6920363677,
0.6617500997,
0.6885187957,
0.6641402897
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python day02/day02-p2.py",
"mean": 3.1411235393800023,
"stddev": 0.09010917592789626,
"median": 3.1516303696400003,
"user": 3.12365489,
"system": 0.0037003824,
"min": 2.9177929816400003,
"max": 3.3309852776400004,
"times": [
2.9652076266400003,
2.94590746764,
2.98981463564,
2.9729601746400003,
3.00578729364,
2.99013505564,
2.95797140864,
2.9177929816400003,
3.01275715464,
2.96446652464,
2.9992746066400002,
3.0681215826400003,
2.9994085316400003,
3.05605645264,
3.0923019056400003,
2.9927535396400002,
3.16385909764,
3.05204224764,
3.0858553146400003,
3.13455088764,
3.00870479064,
3.15192396764,
3.13008368764,
3.02525549964,
3.1751920726400003,
3.05271520864,
3.1651680526400003,
3.08022751464,
3.06994534964,
3.1041971736400003,
3.09049831064,
3.11271712564,
3.14065801364,
3.17754279864,
3.1740638966400003,
3.11830439464,
3.1824652826400004,
3.20768418464,
3.18065167664,
3.14985830764,
3.19244600764,
3.12618327164,
3.15278101564,
3.13079327164,
3.21233919964,
3.22450479464,
3.22261788564,
3.1617373696400004,
3.15098288864,
3.2985043156400002,
3.16874892464,
3.2594790126400004,
3.2451113896400003,
3.1363089956400003,
3.22750851964,
3.1238160186400004,
3.21266349964,
3.19715920764,
3.1400409646400003,
3.22091029564,
3.0808952896400004,
3.17721545864,
3.16580803764,
3.17711754864,
3.22028719564,
3.07481461464,
3.19479676664,
3.06944805064,
3.20435482264,
3.25197998764,
3.1704874646400003,
3.0864505126400004,
3.16557759864,
3.0916870816400004,
3.1974675986400003,
3.10256814464,
3.1972331736400004,
3.10812775564,
3.2413019226400004,
3.1177898556400003,
3.2214804696400003,
3.2363775076400003,
3.18994465864,
3.3309852776400004,
3.10970241464,
3.21878945164,
3.27304197564,
3.12559536564,
3.20429148464,
3.2695753186400003,
3.1288451576400003,
3.1550812336400003,
3.2790448636400003,
3.25666697264,
3.2653465116400002,
3.2582973886400004,
3.15133677164,
3.30450361964,
3.2227860506400003,
3.14573391564
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -2,114 +2,114 @@
"results": [
{
"command": "for run in {1..100}; do target/release/aoc2025 1; done",
"mean": 0.10949902425999998,
"stddev": 0.01303120138107424,
"median": 0.10794122648000001,
"user": 0.0481385,
"system": 0.06004530999999999,
"min": 0.08743557148000002,
"max": 0.14346140548,
"mean": 0.21164170808000005,
"stddev": 0.056955047683642006,
"median": 0.24140312996000002,
"user": 0.08617460999999998,
"system": 0.12323376000000001,
"min": 0.09427125596000001,
"max": 0.29016765496,
"times": [
0.10262904248000002,
0.10309315948000002,
0.08788191948000001,
0.08788880848000001,
0.08988906048000002,
0.08751818448000001,
0.08957111248,
0.09758415848000002,
0.09701446348000001,
0.09691613148000001,
0.09622675148000001,
0.09456499148000001,
0.09579022648000002,
0.09444151848000001,
0.09508792248000002,
0.09606605248000001,
0.09695228048000001,
0.09945660648000001,
0.09628507748000001,
0.09672642548000002,
0.09634512948000001,
0.09588621348000001,
0.09470692948000001,
0.09532162748000002,
0.09455080948000001,
0.09497292148000001,
0.10120339848000001,
0.11154805048000001,
0.11532427548000002,
0.12480157548000002,
0.12592739948,
0.12507496648,
0.12549518748,
0.12522092848,
0.12732470448,
0.12790656448,
0.12489098348000001,
0.13339627348,
0.10624044648000001,
0.10724894148000001,
0.10669420748000001,
0.10763329948000001,
0.10534154348000001,
0.10543322348000002,
0.10665542748000001,
0.10487852848000001,
0.10716879648000001,
0.11600640648000002,
0.11622806648000002,
0.11648707548000001,
0.11719899848000001,
0.11843976248000002,
0.08857608548000001,
0.09061829048000002,
0.08743557148000002,
0.10892493048000002,
0.11079558148000002,
0.11606146848000001,
0.12125704848000002,
0.12159368348000002,
0.11949176648000001,
0.11928547748000001,
0.12190114648000001,
0.12102119648000001,
0.12058027548000001,
0.12061425148000002,
0.12009168948000001,
0.12136069848000001,
0.12952496048,
0.09928884548000001,
0.09773379248000001,
0.09590983548000001,
0.10297853048000001,
0.11318080748000002,
0.11342295148000002,
0.11455993448000001,
0.11295701548000002,
0.11299484748000001,
0.11239145748000001,
0.11219660648000002,
0.11406977448000001,
0.11238566648000001,
0.11289772048000002,
0.11166642748000001,
0.12329825748000002,
0.12529479848,
0.13912101548,
0.14346140548,
0.14263528748,
0.12373552048000001,
0.10561196548000001,
0.10513752748,
0.10701318248000001,
0.10513885148000002,
0.10542516148000002,
0.10548880248000002,
0.10595660348000001,
0.10824915348000001,
0.11516850448000002,
0.12826149748000001
0.09427125596000001,
0.12272227296000002,
0.10814566496000001,
0.10705469596000002,
0.10612934196000001,
0.10502282896000001,
0.11451358096000001,
0.13781039596000003,
0.14639948396000002,
0.14775158996,
0.14817557096,
0.14604463696000003,
0.14846508596000002,
0.15151252196,
0.16783332096,
0.16853679196000002,
0.16997342296,
0.16844706396,
0.16908728596000003,
0.16891443496000003,
0.16828961096000003,
0.16992359796,
0.17080439496000002,
0.19855591796000002,
0.20074445296,
0.21440801796000003,
0.24350181396000004,
0.24561736796000003,
0.24196612596000003,
0.24360409496000002,
0.24331767996000003,
0.24652441296000002,
0.24279184496000003,
0.24485893696000002,
0.24116745896000003,
0.24598800796000003,
0.24296923896000003,
0.24656006396000002,
0.24561899196000003,
0.24682820696000002,
0.24173350996,
0.24652734996000003,
0.24163880096,
0.24588214996000002,
0.24245050996000003,
0.24488809296000003,
0.24555391596000004,
0.24579904396000002,
0.24346369196000003,
0.24628135196000003,
0.24546565196000003,
0.24388913296000003,
0.24583599996000002,
0.24499407696000003,
0.24350880296000002,
0.24843729096000003,
0.24303126896000002,
0.20900605496000002,
0.11419109996000001,
0.11346394096000001,
0.13605218496000002,
0.14135073496000003,
0.14054553696000002,
0.14170314596000003,
0.14030605696,
0.14126451896000003,
0.16392311396,
0.18885592696000003,
0.18878119396,
0.18838356896000003,
0.18918338996000003,
0.18812068296,
0.19095238196000003,
0.19126939996000003,
0.18889649096000002,
0.18961129496,
0.18977580196000002,
0.18796707096,
0.22432580396000001,
0.22725841896,
0.24249487096000003,
0.28284325996,
0.28933039296,
0.28381035196,
0.28812964996,
0.28587865196,
0.28771304996,
0.28530770596,
0.28554755196,
0.28769848096,
0.28434687996,
0.28651199196,
0.28607062296,
0.28923057896,
0.28878584896,
0.28557950296,
0.29016765496,
0.28701344896,
0.28762125696,
0.28466910996
],
"exit_codes": [
0,

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "target/release/aoc2025 2",
"mean": 0.95519874726,
"stddev": 0.044124744291853195,
"median": 0.9539973693000001,
"user": 0.9509290699999997,
"system": 0.0004994800000000004,
"min": 0.9081787933000001,
"max": 1.3391311813,
"times": [
0.9081787933000001,
0.9308759813000002,
0.9142113613000001,
0.9193022683000001,
0.9168911283000001,
0.9253488913000001,
0.9312279043000001,
0.9356256283000001,
0.9492816713000001,
0.9366174083000001,
0.9250868713000001,
0.9360851383000001,
0.9296086603000001,
0.9412757703000001,
0.9305709973000001,
0.9433563383000001,
0.9328483643000001,
0.9234778363000001,
0.9411994823000001,
0.9501147403000001,
0.9559593323000001,
0.9364716953000001,
0.9493212363000001,
0.9406622733000001,
0.9539723113000002,
0.9497769683000001,
0.9555531353000001,
0.9487832943000001,
0.9615137793000001,
0.9561215063000001,
0.9718753403000001,
0.9563764693000001,
0.9643665283000001,
0.9637328313000001,
0.9707989003000002,
0.9186347943000001,
0.9741552383000001,
0.9165410013000002,
0.9262016423000001,
0.9540224273000001,
0.9277363903000001,
0.9548339213000001,
0.9273572813000001,
0.9300478423000001,
0.9528168093000001,
0.9275888603000001,
0.9552747403000001,
0.9330515603000001,
0.9566409853000001,
0.9312747113000001,
0.9553285483000001,
0.9258871153000001,
0.9735189993000001,
0.9729769113000001,
0.9651232503000001,
0.9375781063000002,
0.9767990263000002,
0.9542527273000001,
0.9342905783000001,
0.9631512283000001,
0.9617953713000001,
0.9813052893000002,
0.9570536853000001,
0.9289222813000001,
0.9927794953000001,
0.9329621083000001,
1.3391311813,
0.9325888323000001,
0.9621946303000001,
0.9333018313000001,
0.9646547103,
0.9413923583000001,
0.9640935883000001,
0.9897789913000001,
0.9324330013000001,
0.9643400343000001,
0.9848533673000001,
0.9647858223000001,
0.9767217923000001,
0.9635894333000001,
0.9659293263000001,
0.9638130933000001,
0.9872895043000001,
0.9596654163000001,
0.9833496003000001,
0.9814118083000001,
0.9748250483,
0.9946907663000001,
0.9336311843000001,
0.9904872243000001,
0.9579200363000001,
0.9371263093000001,
0.9715577773000001,
0.9408078893000001,
1.0061055943000001,
0.9466207803000001,
0.9793392493000002,
0.9678916383000001,
0.9669369003000001,
0.9402422413000001
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python 2-1.py",
"mean": 1.5766493539500004,
"stddev": 0.0455222865695424,
"median": 1.5766019187999998,
"user": 1.5664454400000007,
"system": 0.00335977,
"min": 1.4803841823,
"max": 1.6721914603,
"times": [
1.5272328693000001,
1.4921730793,
1.5905018103,
1.4803841823,
1.5308374893,
1.5602105813,
1.5190082873,
1.5376498373,
1.5758360573,
1.4973574432999999,
1.5077385823,
1.5211455033,
1.5376435323,
1.4908944122999999,
1.5514813263,
1.5867757103,
1.5959099863000001,
1.6113877113,
1.5681910803,
1.6264837603,
1.5657511333,
1.5962727323,
1.5743556022999998,
1.4852742363,
1.5863668273,
1.5993799273,
1.6150561123,
1.5037628413,
1.6125845143,
1.5888177133,
1.5342755693,
1.5932445243,
1.5069206643,
1.5635267083,
1.5118950973,
1.5228677273,
1.5397949743,
1.5938155213,
1.5315042873,
1.5977120243,
1.6180576373,
1.5185230233,
1.6455592843,
1.5585295342999999,
1.5982096653,
1.5727382893000001,
1.6029695213,
1.5676065853,
1.6314337483,
1.5089946653,
1.5408961823,
1.6555851813,
1.5751253693,
1.5789429713,
1.6113100123000001,
1.5792668893,
1.5691780553,
1.5274483612999998,
1.6164811452999999,
1.5324931943,
1.6186490903,
1.5466038762999998,
1.6704481293,
1.6247100733,
1.5427539253,
1.6168075493,
1.6188093963,
1.6029602562999998,
1.5761420792999998,
1.5433073123,
1.6179796743,
1.6175545353,
1.6318414422999998,
1.5538511703,
1.5957183363,
1.5548314073,
1.5846359743,
1.6423108263000001,
1.5467988902999998,
1.5631220852999999,
1.5742669633,
1.5770932183,
1.6208351293,
1.5558609233,
1.6271851523,
1.6104170183,
1.6231884473,
1.5770617583,
1.5504421173,
1.6021042633,
1.6312162983,
1.6721914603,
1.5393533342999999,
1.6380897473,
1.6382059013,
1.6621236303,
1.5422585533,
1.6554498563,
1.5422890693,
1.6140952273
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d01p1.py",
"mean": 0.015132811449999992,
"stddev": 0.0007816237374053428,
"median": 0.01486825428,
"user": 0.01270832,
"system": 0.0024101320000000006,
"min": 0.01436241278,
"max": 0.01817732678,
"times": [
0.015518389779999999,
0.01813885378,
0.01605782678,
0.015091580779999999,
0.01528983678,
0.01696367778,
0.01786692578,
0.01604522378,
0.01791159778,
0.01666651378,
0.01663513578,
0.01817732678,
0.01534427378,
0.015055749779999999,
0.014746743779999998,
0.01504438278,
0.014920876779999998,
0.01509644178,
0.01491007578,
0.01587278678,
0.01463246978,
0.015096525779999998,
0.01599748078,
0.01464660278,
0.01487039578,
0.014966278779999998,
0.01553397178,
0.01450562678,
0.01472500278,
0.01479079878,
0.014613496779999999,
0.015052138779999998,
0.015068220779999999,
0.01485035878,
0.01612641578,
0.014659551779999998,
0.014462230779999998,
0.014704591779999998,
0.01579260378,
0.01493656178,
0.014439517780000001,
0.01479319778,
0.01484612778,
0.01487984078,
0.015270242779999998,
0.01478750878,
0.01454116578,
0.01481142378,
0.01486611278,
0.01459962078,
0.015146284779999998,
0.01513184078,
0.014671047779999998,
0.01490411278,
0.01516517878,
0.014547937779999999,
0.01611687378,
0.01479300478,
0.014642981780000001,
0.014990844779999998,
0.01469972478,
0.01436241278,
0.01498505578,
0.015351252780000001,
0.01476563778,
0.01467167778,
0.014857947779999998,
0.014770485779999998,
0.01495125478,
0.014514572779999999,
0.014705532779999999,
0.01481573278,
0.015126245779999999,
0.01509372078,
0.014702891780000001,
0.01464654378,
0.01560098478,
0.01631168578,
0.014627815780000001,
0.01476084078,
0.01483350478,
0.01441758378,
0.01484819678,
0.01461456078,
0.01516131078,
0.01521244678,
0.014570058779999999,
0.01467177078,
0.014837039779999998,
0.014570898780000001,
0.014939095779999998,
0.014654438780000001,
0.014765305779999998,
0.01481357178,
0.01483872578,
0.014888913779999999,
0.014661001779999999,
0.014468301779999998,
0.01495531478,
0.01490667378
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d02p1.py",
"mean": 0.77773528433,
"stddev": 0.013976194777421366,
"median": 0.7759338516400001,
"user": 0.7699287800000004,
"system": 0.004225879999999999,
"min": 0.7490998936400001,
"max": 0.8399190376400001,
"times": [
0.75979596264,
0.7661285686400001,
0.7791226626400001,
0.7490998936400001,
0.7736369176400001,
0.7641418486400001,
0.7793006606400001,
0.76434331064,
0.7799637526400001,
0.7607602726400001,
0.7741888416400001,
0.7949796806400001,
0.77305558764,
0.8012396196400001,
0.77498808364,
0.7862997626400001,
0.7847444226400001,
0.7619847626400001,
0.7837266866400001,
0.7846942496400001,
0.7856272536400001,
0.76538022664,
0.78913555164,
0.7838882036400001,
0.7873134206400001,
0.7824590946400001,
0.7804697756400001,
0.8059732046400001,
0.7866213446400001,
0.7741237476400001,
0.7890587036400001,
0.7789373526400001,
0.7876874266400001,
0.7739823786400001,
0.7752962816400001,
0.7718479856400001,
0.7743720316400001,
0.7731203976400001,
0.7877970456400001,
0.7777499686400001,
0.7680522996400001,
0.7730276016400001,
0.7765714216400001,
0.8324236546400001,
0.7672744766400001,
0.78282582864,
0.7674357836400001,
0.7732558296400001,
0.7678108906400001,
0.77327789964,
0.7674461176400001,
0.7695352836400001,
0.76425323864,
0.7801603266400001,
0.7820577376400001,
0.7893313496400001,
0.7787597436400001,
0.7805181096400001,
0.7672512906400001,
0.7734224456400001,
0.7776302256400001,
0.7647321746400001,
0.7856538736400001,
0.77927853564,
0.8056057246400001,
0.7644001326400001,
0.7673602426400001,
0.7926977196400001,
0.78798424064,
0.76219117564,
0.7637820096400001,
0.7819979216400001,
0.7680101816400001,
0.79594539764,
0.76706916164,
0.7856222366400001,
0.7865205376400001,
0.7643969076400001,
0.7915279496400001,
0.76369593564,
0.7808402326400001,
0.7636531946400001,
0.7681546326400001,
0.7705579516400001,
0.7829478466400001,
0.7934510776400001,
0.76480994964,
0.7774967666400001,
0.7612722326400001,
0.7751671836400001,
0.7646966886400001,
0.7931756816400001,
0.7779745056400001,
0.7818194916400001,
0.7597408616400001,
0.8020904466400001,
0.7604263216400001,
0.8399190376400001,
0.7654483126400001,
0.7720554586400001
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d02p2.py",
"mean": 8.94538261009,
"stddev": 0.2509496444217131,
"median": 9.049778934679999,
"user": 8.905039219999999,
"system": 0.004360440000000002,
"min": 8.43330605468,
"max": 9.28971549368,
"times": [
8.88167304868,
8.46350218868,
8.67955974168,
9.20559683968,
9.04275455968,
8.53011481668,
9.113910668679999,
8.67396180568,
8.98211474468,
9.13243384468,
8.54408974368,
9.16571656168,
9.07330562868,
9.04507466068,
9.12033452368,
8.50616699068,
9.23906340268,
9.12349666168,
8.96128319468,
9.22774800968,
8.95911522268,
9.09715083468,
8.99449587868,
9.12981722168,
9.16881575368,
9.10937898368,
8.59131431268,
9.149065372679999,
9.11519702468,
8.97529310268,
9.11304015268,
8.57284944868,
9.05109928568,
9.11348437868,
9.24477652068,
9.13321668068,
9.08530538368,
9.10167634968,
8.96956938268,
9.03289946468,
9.11982480368,
9.10569408068,
9.03393993968,
9.14796976468,
9.10120584068,
8.91329725468,
8.98842096568,
9.08925683468,
9.01037838268,
8.97055297668,
9.12851075668,
8.76169907768,
8.61325028268,
9.25796331068,
8.65943359468,
9.09327849968,
8.50863367768,
9.08476618868,
8.54501605568,
9.22169484968,
9.12108713468,
8.63231732268,
9.17397773768,
9.20391244368,
8.55778174668,
8.68909028968,
9.18076122568,
9.11404111068,
8.65173546368,
9.27378586668,
8.65780827568,
9.14613413768,
8.67141103168,
9.21394277068,
9.20651857668,
8.55610273368,
8.68119686368,
9.15976400568,
8.57780606068,
9.21236916268,
9.09689742368,
8.59434178568,
9.20229382068,
8.71541957368,
8.58779979768,
9.04920293768,
8.58982091168,
9.28971549368,
8.52752932968,
9.08155105168,
9.05035493168,
8.59374959768,
8.58687716468,
9.02231053868,
9.12043051868,
8.49205575768,
9.05606913268,
8.96841341868,
9.02432827768,
8.43330605468
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

11
bram/benchmarks/vicky.sh Normal file
View File

@ -0,0 +1,11 @@
# Benchmark day 1
hyperfine --warmup 5 --export-json data/vicky-d01-p1.json --runs 100 \
"python vicky_py/d01p1.py"
# hyperfine --warmup 5 --export-json data/vicky-d01-p2.json --runs 100 \
# "python vicky_py/d01p2.py"
# Benchmark day 2
hyperfine --warmup 5 --export-json data/vicky-d02-p1.json --runs 100 \
"python vicky_py/d02p1.py"
hyperfine --warmup 5 --export-json data/vicky-d02-p2.json --runs 100 \
"python vicky_py/d02p2.py"

View File

@ -0,0 +1,47 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 1 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: December 1, 2025
# In[89]:
def rotate_dial(instruction = '', dial_position=50):
# This function rotates the dial based on the input from the set of instructions
# input: instruction = String
# output: dial_position
# Split the instruction into "direction" and "distance"
direction = instruction[0]
distance = int(instruction[1:])
# Calculate final position of the dial
if direction == 'R':
dial_position = (dial_position + distance) % 100
elif direction == 'L':
dial_position = (dial_position - distance) % 100
return dial_position
# In[97]:
# Import instruction file
instructions = open('vicky_py/input01.txt','r')
# In[98]:
# Calculate passcode
dial_position = 50
passcode = 0
for instruction in instructions:
dial_position = rotate_dial(instruction, dial_position)
if dial_position == 0:
passcode = passcode + 1
print(passcode)

View File

@ -0,0 +1,133 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 2, 2025
# In[18]:
def find_invalid_ids(id_range=''):
# This function finds the invalid ids within the specified range (part 1)
# input: id_range = String
# output: invalid_ids = int []
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
if len(id_string) % 2 == 0:
middle_point = len(id_string) // 2 # Find where to split the product id in 2
# Compare the two halves of the id to determine if the id is invalid
first_half = id_string[0:middle_point]
second_half = id_string[middle_point:]
if first_half == second_half: # If the two halves are equal, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
return invalid_ids
# In[33]:
def chop_product_id(id):
# This function chops a product id into chunks of equal sizes
# input: id = int
# output: chopped_id = [[]]
id_string = str(id)
chunks = []
chopped_id = []
# Find divisors to split the id into equal-sized chunks
# (aka: how many ways to split the id into equal-sized chunks are there?)
for divisor in range(2,len(id_string) + 1):
if len(id_string) % divisor == 0:
chunks = []
chunk_size = len(id_string) // divisor # Determine how big a chunk would be
for i in range(1,len(id_string)+1,chunk_size): # Chop the id
chunk = id_string[i-1:(i-1 + chunk_size)]
chunks.append(chunk)
chopped_id.append(chunks)
return chopped_id
# In[49]:
# Read product ID ranges file
import csv
input_file = open('../rust/inputs/02.txt', mode ='r') # Open in 'read only' mode
id_ranges_csv = csv.reader(input_file)
id_ranges_list = list(id_ranges_csv)
# In[51]:
def find_all_invalid_ids(id_range=''):
# This function finds all the invalid ids within the specified range (part 2)
# input: id_range = String
# output: invalid_ids = int [[]]
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
chopped_ids = chop_product_id(id) # Chop each product id into equal-sized pieces
# Identify ids with a repeating pattern
for list in chopped_ids:
chunks_set = set(list) # Convert each group of equal-sized chunks into a set
if len(chunks_set) == 1: # If the resulting set has only 1 element, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
break
return(invalid_ids)
# In[52]:
# Get invalid ids and calculate answer
invalid_ids = []
id_ranges = []
for id_range in id_ranges_list[0]:
invalid_ids_range = find_invalid_ids(id_range) # For part 1 answer
# invalid_ids_range = find_all_invalid_ids(id_range) # For part 2 answer
invalid_ids.append(invalid_ids_range[:])
sum_invalid_ids = sum(sum(invalid_ids,[]))
# print(invalid_ids)
print(sum_invalid_ids)

View File

@ -0,0 +1,133 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 2, 2025
# In[18]:
def find_invalid_ids(id_range=''):
# This function finds the invalid ids within the specified range (part 1)
# input: id_range = String
# output: invalid_ids = int []
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
if len(id_string) % 2 == 0:
middle_point = len(id_string) // 2 # Find where to split the product id in 2
# Compare the two halves of the id to determine if the id is invalid
first_half = id_string[0:middle_point]
second_half = id_string[middle_point:]
if first_half == second_half: # If the two halves are equal, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
return invalid_ids
# In[33]:
def chop_product_id(id):
# This function chops a product id into chunks of equal sizes
# input: id = int
# output: chopped_id = [[]]
id_string = str(id)
chunks = []
chopped_id = []
# Find divisors to split the id into equal-sized chunks
# (aka: how many ways to split the id into equal-sized chunks are there?)
for divisor in range(2,len(id_string) + 1):
if len(id_string) % divisor == 0:
chunks = []
chunk_size = len(id_string) // divisor # Determine how big a chunk would be
for i in range(1,len(id_string)+1,chunk_size): # Chop the id
chunk = id_string[i-1:(i-1 + chunk_size)]
chunks.append(chunk)
chopped_id.append(chunks)
return chopped_id
# In[49]:
# Read product ID ranges file
import csv
input_file = open('../rust/inputs/02.txt', mode ='r') # Open in 'read only' mode
id_ranges_csv = csv.reader(input_file)
id_ranges_list = list(id_ranges_csv)
# In[51]:
def find_all_invalid_ids(id_range=''):
# This function finds all the invalid ids within the specified range (part 2)
# input: id_range = String
# output: invalid_ids = int [[]]
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
chopped_ids = chop_product_id(id) # Chop each product id into equal-sized pieces
# Identify ids with a repeating pattern
for list in chopped_ids:
chunks_set = set(list) # Convert each group of equal-sized chunks into a set
if len(chunks_set) == 1: # If the resulting set has only 1 element, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
break
return(invalid_ids)
# In[52]:
# Get invalid ids and calculate answer
invalid_ids = []
id_ranges = []
for id_range in id_ranges_list[0]:
# invalid_ids_range = find_invalid_ids(id_range) # For part 1 answer
invalid_ids_range = find_all_invalid_ids(id_range) # For part 2 answer
invalid_ids.append(invalid_ids_range[:])
sum_invalid_ids = sum(sum(invalid_ids,[]))
# print(invalid_ids)
print(sum_invalid_ids)

File diff suppressed because it is too large Load Diff