* src/search.c (Freplace_match): Speed up non-literal (but
actually literal) common case.
This makes
(benchmark-run
1000000
(replace-regexp-in-string
"a+" "foo"
"ogihdipofdhookfdohkfdpokhpokhfdpokfdhpokfdhkdfkhgoadfphokfkhpofdkhkdpokf"))
about 10% faster.
if (! NILP (string))
CHECK_STRING (string);
+ /* Most replacement texts don't contain any backslash directives in
+ the replacements. Check whether that's the case, which will
+ enable us to take the fast path later. */
+ if (NILP (literal)
+ && !memchr (SSDATA (newtext), '\\', SBYTES (newtext)))
+ literal = Qt;
+
case_action = nochange; /* We tried an initialization */
/* but some C compilers blew it */