If we've already search()ed for a rune, all of its results will be duplicates.
So we can fail early on that. (In other words, if our search string has
duplicate runes, we can skip over the results from the duplicated runes.)
Also, if we're revisiting a node for any other reason, we've already traversed
all results below it, so we can return early in that case.
This patch leads to staggering, almost incomprehensible speedups.
If we've already search()ed for a rune, all of its results will be duplicates. So we can fail early on that. (In other words, if our search string has duplicate runes, we can skip over the results from the duplicated runes.)
Also, if we're revisiting a node for any other reason, we've already traversed all results below it, so we can return early in that case.
This patch leads to staggering, almost incomprehensible speedups.