wingo pushed a commit to branch wip-port-refactor
in repository guile.
commit a8fe0f42f3483e79ac633d2e7451ad186d5a3b79
Author: Andy Wingo <[email protected]>
Date: Tue May 10 16:30:50 2016 +0200
%read-char speedup
* module/ice-9/ports.scm (%read-char): Always call update-position! with
the same continuation, so that it will contify.
---
module/ice-9/ports.scm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index 43283e7..27a5708 100644
--- a/module/ice-9/ports.scm
+++ b/module/ice-9/ports.scm
@@ -492,9 +492,10 @@ interpret its input and output."
(let ((buf (port-read-buffer port)))
(set-port-buffer-cur! buf (+ (port-buffer-cur buf) len))
(if (eq? char the-eof-object)
- (set-port-buffer-has-eof?! buf #f)
- (update-position! char))
- char))))
+ (begin
+ (set-port-buffer-has-eof?! buf #f)
+ char)
+ (update-position! char))))))
(define (fast-path buf bv cur buffered)
(let ((u8 (bytevector-u8-ref bv cur))
(enc (%port-encoding port)))