From e97def2bbce7777d3afc916a5aa4d951fab5f3f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 15 Aug 2020 10:48:37 -0700 Subject: [PATCH] Fdelete speed tweak for strings * src/fns.c (Fdelete): Hoist FIXNUMP out of a loop, and turn it into CHARACTERP. --- src/fns.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fns.c b/src/fns.c index ded6f344aad..c89bd8144e7 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1766,6 +1766,9 @@ changing the value of a sequence `foo'. */) } else if (STRINGP (seq)) { + if (!CHARACTERP (elt)) + return seq; + ptrdiff_t i, ibyte, nchars, nbytes, cbytes; int c; @@ -1784,7 +1787,7 @@ changing the value of a sequence `foo'. */) cbytes = 1; } - if (!FIXNUMP (elt) || c != XFIXNUM (elt)) + if (c != XFIXNUM (elt)) { ++nchars; nbytes += cbytes; @@ -1814,7 +1817,7 @@ changing the value of a sequence `foo'. */) cbytes = 1; } - if (!FIXNUMP (elt) || c != XFIXNUM (elt)) + if (c != XFIXNUM (elt)) { unsigned char *from = SDATA (seq) + ibyte; unsigned char *to = SDATA (tem) + nbytes; -- 2.39.5