Replace non-greedy regexp with a char-complement to improve matching performance.
Measurements show a runtime improvement of about 10% for string-heavy JSON documents. http://lists.racket-lang.org/users/archive/2013-January/055953.html
This commit is contained in:
parent
8562310f38
commit
aa3f44dffa
|
@ -107,7 +107,7 @@
|
|||
(define (read-string)
|
||||
(let loop ([l* '()])
|
||||
;; note: use a string regexp to extract utf-8-able text
|
||||
(define m (cdr (or (regexp-try-match #rx"^(.*?)(\"|\\\\(.))" i)
|
||||
(define m (cdr (or (regexp-try-match #rx"^([^\"\\]*)(\"|\\\\(.))" i)
|
||||
(err "unterminated string"))))
|
||||
(define l (if ((bytes-length (car m)) . > . 0) (cons (car m) l*) l*))
|
||||
(define esc (caddr m))
|
||||
|
|
Loading…
Reference in New Issue
Block a user