3 ms·
There’s plenty of strategies. In this case, if you can see two code based behaviors have diverged, just run both through a step by step debugger and see where
by markerz 2y ago
There’s plenty of strategies.
In this case, if you can see two code based behaviors have diverged, just run both through a step by step debugger and see where they diverge.
Or if you run both through a profiler, you can see what segment of code is taking a crazy amount of time in comparison.
In general, narrowing down what you’re looking at is the goal. In this case, a big hint is that the code should be O(nlogn) but is actually O(n^2) which is a huge hint that we’re in a nested loop and the break condition isn’t getting triggered properly. I would have looked closely at the loops because of this.
The code itself is ~400 lines long minus a bunch of comments. This feels very approachable to skim through in an hour.
I also love creating new variables and naming them what I’m learning. Often times naming things will make bugs very obvious.
- euroderf 2y ago> I also love creating new variables and naming them what I’m learning. Often times naming things will make bugs very obvious. Agreed. There should be a formalish name for this technique/style.