1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 22:40:34 +02:00

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.
This commit is contained in:
Andy Wingo 2021-02-17 12:10:57 +01:00
parent 5cd28ae0ac
commit beac6a3e29

View file

@ -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)
(begin
(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)