Perfectionism could be generally defined as an approach to solving problems and completing tasks fixated primarily on minimizing perceived imperfection.
Depth-first search, meanwhile, is an algorithm for traversing tree structures, which starts at the root, then goes down a single branch until it hits a leaf. Upon reaching a leaf, it backtracks to the last node whose descendants aren't fully searched, and goes down a new branch. This process repeats until the whole tree is explored.
Recently, I realized, in a flash of insight while struggling to stop tweaking tiny flaws long enough to complete a project, that there is a possibly fruitful analogy between these two things.
Every task can be thought of as a tree of sub-tasks. In fact, while writing this very essay, I broke the main idea down into a tree of questions and answers, to help me think about it (essentially an outline, but with each statement having only questions as sub-elements, and each question only having answer statements beneath it). Similarly, when writing a program, one usually splits it into subroutines, themselves split into sub-subroutines.
Perfectionists tend to focus more on sub-tasks lower on the tree. For instance, when writing, I tend to fixate on word choice and comparatively neglect overall structure, and some people trying to tidy up might heavily clean each object, one by one, and burn out before touching most of what's in the room, instead of the standard approach - getting the whole room mostly clean prior to obsessing over specifics. The reason an aversion to imperfection motivates such behavior might be that smaller flaws are easier to perceive, and easier to fix - thus drawing more attention to themselves.
This interestingly parallels the way that depth-first search preferentially moves down the tree while searching - where searching the tree in this analogy represents working on tasks or sub-tasks, with the current node being visited representing the sub-task currently being worked on. A perfectionist will often be tempted to drill right down to a single detail, get it "right", then go to a related detail, and so on, wandering somewhat aimlessly through the leaves of the tree while barely touching the branches.
The reason this matters is that in most task trees, most value comes from working on nodes closer to the root - as higher-level sub-tasks usually lay necessary foundations on which lower-level details can be added later, and it is often much better to get every sub-task somewhat done, than just one or a few sub-tasks completely done. (Though, as a counterexample, in a complex machine, even a single part working incorrectly may make the whole machine fail - a case where perfectionism might be warranted!)
Perfectionism, though, spends most of its time far from the root, down in the dirty details. This means that (except in cases like that complex machine) it is usually less efficient than a more "breadth-first" work style would be - some way of doing tasks that prioritizes large sub-tasks, gradually building in smaller details after starting from a vague outline - similar to breadth-first search, an alternative to depth-first search which explores each horizontal level of the tree in turn rather than running up and down branches - the Veðrfölnir to depth-first search's Ratatoskr. Examples of working in a breadth-first way are outlining a program with dummy functions as a sanity check before filling in exactly how they work, and writing a messy first draft to get an idea down before editing it later.
Note that this analogy may not hold in cases where perfectionism is due to inaccurate measurement of value, rather than focus on details. Someone unable to decide how to do a task might try many approaches (like a breadth-first search) without going deeply into any, if they feel that they cannot afford to waste any effort on the wrong approach (going deeply into the wrong branch). This tends to be my problem, but in small, constrained tasks like writing an essay, a breadth-first approach (careful outlining, and refusing to tweak word choice until the very end) seems to work.
What I'd like to do now is work on ways to "breadth-ify" situations in which I commonly get sucked into perfectionistic tweaking, by creating incentives towards laying foundations first, which I hope would counteract my natural tendency to nitpick. I have some ideas about how to do this, and I used one to organize my thoughts in writing this - a variant of outlining that I am experimenting with, involving writing the outline as alternating layers of questions and answers, and applying a numeric priority score to each element of the outline which is proportional both to subjective importance, and to level on the tree - but I will have to explore this more. If anyone has ideas about how to do this, or how to apply this idea to things other than writing, please let me know!