I just completed all 12 days of Advent of Code 2025!
adventofcode.com
#AdventOfCode
@jstanden.bsky.social
Founder & Software Architect @ cerb.ai I've been obsessed with coding since the dial-up BBS days of the early 1990s. My daily stack is PHP/MySQL/AWS/Docker, with increasingly more Python for devops/ML. #php #mysql #aws #python #docker #german #piano
I just completed all 12 days of Advent of Code 2025!
adventofcode.com
#AdventOfCode
I've completed "Christmas Tree Farm" - Day 12 - Advent of Code 2025
I was _deeply_ unsatisfied with this solution, so I've been turning it into a game and working on an actual solver instead.
github.com/jstanden/adv...
#AdventOfCode #Python #Programming
Since I used nx.topological_sort() to do the heavy lifting for me on this one, here's an implementation of Kahn's algorithm to do the same thing for any graph model.
github.com/jstanden/adv...
I used z3, but went back and re-learned Gaussian Elimination (like I seem to do every year).
You can at least feel some measure of comfort that a lot of people probably also used AI to generate those solver examples.
As penance for using Z3 on Day 10 pt2, I wrote down some notes and worked examples for linear Diophantine equations and Gaussian Elimination w/ matrices.
This comes up every year and I never remember it.
I worked a few examples from my Day 10 input.
github.com/jstanden/adv...
#AdventOfCode #math
Good question. If I get a few mins before the next puzzle tonight, I'll swap in the dataclass decorator in place of the tuple and see if it has the same issue.
Just using tuples and a 'visited' set I knocked the initial 40s down to 20ms. The object copy may still drag before checking the set.
It's also worth mentioning on this post that I added a two lines of code to track visited states, and the code runs in 20ms. The several second solution time was just my naive implementation and not a Python issue.
11.12.2025 22:11 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0Also for education. When I'm helping my son visualize something like rigid transformations in geometry, I just open a Jupyter notebook and write a couple lines of code w/ Shapely and we get a pretty chart in under 5 mins.
If we fire up C/Rust/Go, I'd lose the afternoon.
You aren't wrong about parallel computing either. For web apps, we also deal with that limitation in Apache/Nginx process managers. Interpreter overhead vs threaded event queue is an issue.
There's always a tradeoff in developer time vs compute time, and the former is often far more expensive.
Yeah, there are absolutely large swaths of programming where Python isn't the right tool. I wouldn't use it where every cycle/byte matters (AAA game, an OS).
For web apps, min ideal light speed one-way latency LA to London is ~29ms. Realistically 2-3X. Compiled vs interpreted is rarely noticeable.
Most of the time I need to get a quick throw-away answer on some question from a pile of data, and I haven't found anything that beats Python and a Jupyter notebook with inline plots.
I've used PHP for 24 years on a SaaS project, and it's never the bottleneck. It's almost always the relational DB.
Personally, I find Python both fun and efficient for data analysis, manipulation, and visualization (e.g. numpy, pandas, networkx, z3, matplotlib, scipy). That makes up most of my actual work.
It's the exception when I write production code for extreme efficiency/performance. I'd use a library.
Yeah, this is a great point. I may not technically be defining a single class for any AoC challenge this year, but that's a ton of overhead to subclass/override the existing tuple class.
namedtuple._replace() is expensive to copy w/ modification.
My big speedup was just a visited states set.
This is fascinating. Thanks for the tip! ๐
I had actually just bookmarked this old school bit hacks archive: graphics.stanford.edu/~seander/bit...
Sure, but there isn't a single programming language that's good at everything. The more languages you learn the easier any future one is, since algorithmic thinking is what matters vs syntax. I learned C in 1995. I've made a great living on PHP for 25 years. C/Rust/Go being faster never mattered.
11.12.2025 21:35 โ ๐ 0 ๐ 0 ๐ฌ 1 ๐ 0You're probably right about the network effect being a major reason. The creator of Python (Guido van Rossum) worked at Google and they promoted it heavily 10+ years ago. Notebooks + interpreter make it easy to play with data vs compiled, even if not the fastest. Tons of libraries. It's fun to use.
11.12.2025 21:28 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0The networkx graph visualization made the bottlenecks obvious. ๐ I spent too long thinking that they mattered, but I assume all other inputs were also directed and acyclic.
11.12.2025 21:23 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0Readability on the state objects in my BFS queue while avoiding classes/structs. I also used them for the machine schematics, but we only had a few hundred.
Could have been dictionaries. Immutable tuples are more memory efficient, but the hidden 'class' overhead is too expensive for this case.
I've completed "Reactor" - Day 11 - Advent of Code 2025
I spent a while severing bottleneck edges in Part 2 before remembering the trick to past problems like this. The result is a couple lines and ~30ms.
github.com/jstanden/adv...
#AdventOfCode #Python #Programming
Quick visualization while untangling AoC 2025 Day 11 Part 2.
#AdventOfCode #networkx
I added 2 lines for a 'visited' states set and BFS runs in milliseconds. ๐
10.12.2025 23:34 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0Great tip! I felt like there was probably a way to treat it like Dijkstra. ๐
10.12.2025 21:32 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0Python's namedtuples apparently have major overhead. I replaced my BFS queue state for Day 10 Part 1 with tuples and the runtime dropped from 45s to 14s.
I'm sure I can optimize it further with just math, but the solution is only ~7 lines of code.
#AdventOfCode #Python #Programming
I've completed "Factory" - Day 10 - Advent of Code 2025
I used Z3 to solve Part 2 in ~500ms. I still need to clean up Part 1's brute force.
github.com/jstanden/adv...
#AdventOfCode #Python #Programming #z3
Part 1 and Part 2 visualizations in matplotlib for 2025 Day 9.
#Python #matplotlib #shapely
I've completed "Movie Theater" - Day 9 - Advent of Code 2025
My shortest solution so far thanks to the shapely Python library in Part 2.
github.com/jstanden/adv...
#AdventOfCode #Python #Programming
I've completed "Playground" - Day 8 - Advent of Code 2025
networkx and heapq did the heavy lifting on this one. It's super short but not particularly efficient (~1.8s).
github.com/jstanden/adv...
#AdventOfCode #Python #Programming
That's super efficient code. Nice work! ๐
08.12.2025 01:31 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0Yeah, and after participating for several years you start expecting at least one of each core type of problem, and can identify which it is from the ASCII sample data. ๐
08.12.2025 01:13 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0Yeah, AoC is a good excuse to practice regex, but I've only barely used them on puzzles this year so far.
The 10xE15 skill would have helped on Day 7 today. I usually detect those problems when my code runs more than 2 seconds and I realize I'm going to have to toss it and start over. ๐