It’s a little complicated ![]()
So the code sets a budget: a maximum number of comparisons it’s allowed to make before it must stop and say “this is too hard.”
How the budget is calculated?
- It takes the combined size of the two texts and multiplies by 200. Bigger texts get a bigger budget.
- But there’s a hard ceiling of 2 million comparisons—no matter how big the texts are, it will never try more than that.
What happens when the budget runs out?
- The code raises its hand and says “I give up”—it throws an error (
DiffLimitExceeded) rather than letting the server grind away for seconds or minutes