Andreas Schwab writes: >> I did some trivial benchmarking with >> >> (while (search-backward "\n(defun " nil t))) >> >> and the equivalent re-search-backward in a buffer in a loop, and the >> search-backward version was about 8x faster. > > How did you measure that? When I tried I did not see any significant > difference. I just call the stuff I want to benchmark a gazillion times with my tiny benchmark.el package: (benchmark 10000 (goto-char (point-min)) (while (search-forward "\n(defun " nil t) (forward-line 1)))