APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1508248110 -3600
# Tue Oct 17 14:48:30 2017 +0100
# Node ID 95a188885942f52fda8d85b7f132163a90fd8943
# Parent 81e6fa9d46d02bedd36f321266b3f5787055e1b0
Handle START a bit better for string arguments, #'find, #'position
src/ChangeLog addition:
2017-10-17 Aidan Kehoe <kehoea(a)parhasard.net>
* sequence.c (position):
Handle START a bit better, use XSTRING_ASCII_BEGIN() so we don't
have to step through each character for the constant-byte-length
part of the string.
diff -r 81e6fa9d46d0 -r 95a188885942 src/ChangeLog
--- a/src/ChangeLog Tue Oct 17 14:16:04 2017 +0100
+++ b/src/ChangeLog Tue Oct 17 14:48:30 2017 +0100
@@ -1,3 +1,10 @@
+2017-10-17 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * sequence.c (position):
+ Handle START a bit better, use XSTRING_ASCII_BEGIN() so we don't
+ have to step through each character for the constant-byte-length
+ part of the string.
+
2017-10-13 Aidan Kehoe <kehoea(a)parhasard.net>
* doc.c:
diff -r 81e6fa9d46d0 -r 95a188885942 src/sequence.c
--- a/src/sequence.c Tue Oct 17 14:16:04 2017 +0100
+++ b/src/sequence.c Tue Oct 17 14:48:30 2017 +0100
@@ -1681,10 +1681,16 @@
}
else if (STRINGP (sequence))
{
- Ibyte *startp = XSTRING_DATA (sequence), *cursor = startp;
- Bytecount byte_len = XSTRING_LENGTH (sequence), cursor_offset = 0;
+ Ibyte *startp = XSTRING_DATA (sequence), *cursor;
+ Bytecount byte_len = XSTRING_LENGTH (sequence), cursor_offset;
Lisp_Object character = Qnil;
+ cursor_offset = ii = (Bytecount) (min (XSTRING_ASCII_BEGIN (sequence),
+ starting));
+ cursor = startp + cursor_offset;
+ /* It's probably worth making this even faster for the
+ non-variable-width-string case. Not now, though. */
+
while (cursor_offset < byte_len && ii < ending)
{
if (ii >= starting)
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by date