The following code takes a long time to run. In fact, I’m writing this blog post while this is running, and I’m not sure how long that will take.
Update: This took over a minute to complete on my machine (which is pretty nice).
The killer is that this code is correct, it does the right thing, but it can be slow. I stripped a much larger scenario to ~50 lines of code, can you see what is going on? And why?