Adapt recursion thresholds to window size