From: Richard M. Stallman Date: Fri, 19 Jul 2013 16:15:51 +0000 (-0400) Subject: (decode_coding_utf_8): Add simple loop for fast processing of ASCII characters. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1759^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a1aeeffedd3b05a33bdd73737651debbda00cf5f;p=emacs.git (decode_coding_utf_8): Add simple loop for fast processing of ASCII characters. --- diff --git a/src/ChangeLog b/src/ChangeLog index 3f67e37a107..975bcaaba0e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-07-19 Richard Stallman + + * coding.c (decode_coding_utf_8): Add simple loop for fast + processing of ASCII characters. + 2013-07-19 Paul Eggert * conf_post.h (RE_TRANSLATE_P) [emacs]: Remove obsolete optimization. diff --git a/src/coding.c b/src/coding.c index e779197bbde..385a22a188d 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1363,6 +1363,45 @@ decode_coding_utf_8 (struct coding_system *coding) break; } + /* In the simple case, rapidly handle ordinary characters */ + if (multibytep && ! eol_dos + && charbuf < charbuf_end - 6 && src < src_end - 6) + { + while (charbuf < charbuf_end - 6 && src < src_end - 6) + { + c1 = *src; + if (c1 & 0x80) + break; + src++; + consumed_chars++; + *charbuf++ = c1; + + c1 = *src; + if (c1 & 0x80) + break; + src++; + consumed_chars++; + *charbuf++ = c1; + + c1 = *src; + if (c1 & 0x80) + break; + src++; + consumed_chars++; + *charbuf++ = c1; + + c1 = *src; + if (c1 & 0x80) + break; + src++; + consumed_chars++; + *charbuf++ = c1; + } + /* If we handled at least one character, restart the main loop. */ + if (src != src_base) + continue; + } + if (byte_after_cr >= 0) c1 = byte_after_cr, byte_after_cr = -1; else