Optimize when sep is unspecified or the default regexp

This commit is contained in:
Brian Adkins 2021-03-23 15:37:48 -04:00 committed by Matthew Flatt
parent 754b3457c3
commit f65560ed4c

View File

@ -148,7 +148,9 @@
[else (loop beg (add1 end))])))
(define (string-split str [sep none] #:trim? [trim? #t] #:repeat? [+? #f])
(if (and (string? str) (eq? sep none) trim?)
(if (and (string? str)
(or (eq? sep none) (eq? sep #px"\\s+"))
trim?)
(internal-split-whitespace str)
(internal-split 'string-split str sep trim? +?)))