diff options
author | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2010-02-15 16:24:07 +0000 |
---|---|---|
committer | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2010-02-15 16:24:07 +0000 |
commit | 74f9b1e0c825af789c2a66fda7b2688091379034 (patch) | |
tree | c1d606175867d2e19a6a8efe332a159935219a8a /lib/util.ml | |
parent | f69a763613b1d7e3e0a44085be18f56299097576 (diff) |
Util.lowercase_unicode: avoid creating the segmenttree each time (speeds some contribs by >30%) (BACKPORT 12768)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12769 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/util.ml')
-rw-r--r-- | lib/util.ml | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/util.ml b/lib/util.ml index 8512e10e1..a2c6c7899 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -347,9 +347,10 @@ let check_ident_gen handle s = let check_ident_soft = check_ident_gen warning let check_ident = check_ident_gen error -let lowercase_unicode s unicode = +let lowercase_unicode = let tree = Segmenttree.make Unicodetable.to_lower in - try + fun unicode -> + try match Segmenttree.lookup unicode tree with | `Abs c -> c | `Delta d -> unicode + d @@ -358,7 +359,7 @@ let lowercase_unicode s unicode = let lowercase_first_char_utf8 s = assert (s <> ""); let j, n = next_utf8 s 0 in - utf8_of_unicode (lowercase_unicode (String.sub s 0 j) n) + utf8_of_unicode (lowercase_unicode n) (* Lists *) |