misc changes to speed up doc search generation

Cuts about 30% of the time on my machine.

original commit: 815fd1b49c7b7857aa08fd15c5ec77655ac84859
This commit is contained in:
Matthew Flatt 2012-06-08 15:57:07 +08:00
parent 3ac30a1f35
commit f1aa676101

View File

@ -1382,12 +1382,14 @@
(list (format "~s" i))]))
(define/private (ascii-ize s)
(let ([m (regexp-match-positions #rx"[^\u01-\u7E]" s)])
(if m
(append (ascii-ize (substring s 0 (caar m)))
(list (char->integer (string-ref s (caar m))))
(ascii-ize (substring s (cdar m))))
(list s))))
(if (= (string-utf-8-length s) (string-length s))
(list s)
(let ([m (regexp-match-positions #rx"[^\u01-\u7E]" s)])
(if m
(append (ascii-ize (substring s 0 (caar m)))
(list (char->integer (string-ref s (caar m))))
(ascii-ize (substring s (cdar m))))
(list s)))))
;; ----------------------------------------