From 2e594e3c7cd605193cd8c997e19c417c20b42b64 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Tue, 27 May 2014 19:30:20 -0400 Subject: [PATCH] ~8% improvement in parsing speed by using a Set for op-chars --- src/julia-parser.scm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 14a664d7a603b..07bb84663f845 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -68,13 +68,12 @@ (apply append (map eval prec-names))))) (define op-chars - (list->string - (delete-duplicates - (apply append - (map string->list (map symbol->string operators)))))) + (delete-duplicates + (apply append + (map string->list (map symbol->string operators))))) ;; characters that can be in an operator -(define (opchar? c) (and (char? c) (string.find op-chars c))) +(define opchar? (Set op-chars)) ;; characters that can follow . in an operator (define (dot-opchar? c) (and (char? c) (string.find ".*^/\\+-'<>!=%" c))) (define operator? (Set operators))