[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 03/03: Speed up peek-char

From: Andy Wingo
Subject: [Guile-commits] 03/03: Speed up peek-char
Date: Thu, 05 May 2016 20:59:10 +0000

wingo pushed a commit to branch wip-port-refactor
in repository guile.

commit 0b4b4db9fa088b854331a4d1e6a6ba7e04429f07
Author: Andy Wingo <address@hidden>
Date:   Thu May 5 22:57:33 2016 +0200

    Speed up peek-char
    * module/ice-9/ports.scm (peek-char-and-len): Only inline fast path for
 module/ice-9/ports.scm |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index 41eb866..7dc13d7 100644
--- a/module/ice-9/ports.scm
+++ b/module/ice-9/ports.scm
@@ -304,7 +304,7 @@ interpret its input and output."
 (define-syntax-rule (decoding-error subr port)
   (throw 'decoding-error subr "input decoding error" EILSEQ port))
-(define-inlinable (peek-char-and-len/utf8 port first-byte)
+(define (peek-char-and-len/utf8 port first-byte)
   (define (bad-utf8 len)
     (if (eq? (port-conversion-strategy port) 'substitute)
         (values #\? len)
@@ -405,7 +405,9 @@ interpret its input and output."
         (let ((first-byte (logand first-byte #xff)))
           (case (%port-encoding port)
-             (peek-char-and-len/utf8 port first-byte))
+             (if (< first-byte #x80)
+                 (values (integer->char first-byte) 1)
+                 (peek-char-and-len/utf8 port first-byte)))
              (peek-char-and-len/iso-8859-1 port first-byte))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]