commit f1aa6761014cce855e75d6570fa8aa7012d34e35 parent 3ac30a1f35b100c3b97a779e5f1e17daa2736a56 Author: Matthew Flatt <mflatt@racket-lang.org> Date: Fri, 8 Jun 2012 15:57:07 +0800 misc changes to speed up doc search generation Cuts about 30% of the time on my machine. original commit: 815fd1b49c7b7857aa08fd15c5ec77655ac84859 Diffstat:
| M | collects/scribble/html-render.rkt | | | 14 | ++++++++------ |
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt @@ -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))))) ;; ----------------------------------------