[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/04: Micro-optimization to delimiter?
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/04: Micro-optimization to delimiter? |
Date: |
Wed, 17 Feb 2021 06:15:06 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 5cd28ae0ace69ba044845e07619ec7237ba8fc51
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Wed Feb 17 12:04:18 2021 +0100
Micro-optimization to delimiter?
* module/ice-9/read.scm (read): Make sure we hit the "case"
optimization.
---
module/ice-9/read.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index 98261e2..a14ad02 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -182,10 +182,11 @@
(take-until first (lambda (ch) (not (pred ch)))))
(define (delimiter? ch)
- (or (memv ch '(#\( #\) #\; #\"
- #\space #\return #\ff #\newline #\tab))
- (and (memv ch '(#\[ #\])) (or (square-brackets?) (curly-infix?)))
- (and (memv ch '(#\{ #\})) (curly-infix?))))
+ (case ch
+ ((#\( #\) #\; #\" #\space #\return #\ff #\newline #\tab) #t)
+ ((#\[ #\]) (or (square-brackets?) (curly-infix?)))
+ ((#\{ #\}) (curly-infix?))
+ (else #f)))
(define (read-token ch)
(take-until ch delimiter?))