[Top][All Lists]

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

[Guile-commits] 03/04: More read micro-optimizations

From: Andy Wingo
Subject: [Guile-commits] 03/04: More read micro-optimizations
Date: Wed, 17 Feb 2021 06:15:07 -0500 (EST)

wingo pushed a commit to branch master
in repository guile.

commit beac6a3e292b93a199b12232d5e83f581d9b2ab6
Author: Andy Wingo <>
AuthorDate: Wed Feb 17 12:10:57 2021 +0100

    More read micro-optimizations
    * module/ice-9/read.scm (read): Use R5RS read-char, peek-char,
      write-char rather than (ice-9 textual-ports) wrappers, because the
      latter are expressed in terms of the former.
 module/ice-9/read.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index a14ad02..04e3cac 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -130,14 +130,14 @@
   (define (curly-infix?) (enabled? bitfield:curly-infix?))
   (define (r7rs-symbols?) (enabled? bitfield:r7rs-symbols?))
   (define neoteric 0)
-  (define (next) (get-char port))
-  (define (peek) (lookahead-char port))
+  (define (next) (read-char port))
+  (define (peek) (peek-char port))
   (define filename (port-filename port))
   (define (get-pos) (cons (port-line port) (port-column port)))
   (define accumulator (open-output-string))
   (define-syntax-rule (accumulate proc)
-      (proc (lambda (ch) (put-char accumulator ch)))
+      (proc (lambda (ch) (write-char ch accumulator)))
       (let ((str (get-output-string accumulator)))
         (seek accumulator 0 SEEK_SET)
         (truncate-file accumulator 0)

reply via email to

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