]> gitweb.factorcode.org Git - factor.git/commitdiff
benchmark.unicode: add benchmark for unicode case conversions.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 19 Sep 2012 16:56:24 +0000 (09:56 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 19 Sep 2012 17:33:51 +0000 (10:33 -0700)
extra/benchmark/unicode/unicode.factor [new file with mode: 0644]

diff --git a/extra/benchmark/unicode/unicode.factor b/extra/benchmark/unicode/unicode.factor
new file mode 100644 (file)
index 0000000..8b793f8
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2012 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math random sequences strings unicode.case ;
+IN: benchmark.unicode
+
+: crazy-unicode-string ( -- string )
+    8 [ 8 0xffff random-integers ] replicate " " join ;
+
+: unicode-benchmark ( -- )
+    crazy-unicode-string 8 [
+        [ >title ] [ >lower ] [ >upper ] tri 3append
+        ! [ >lower ] [ >upper ] bi append
+    ] times drop ;
+
+MAIN: unicode-benchmark