]> gitweb.factorcode.org Git - factor.git/commitdiff
benchmark.lexer: adding a lexer benchmark.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 21 May 2014 02:15:12 +0000 (19:15 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 21 May 2014 02:15:12 +0000 (19:15 -0700)
extra/benchmark/lexer/lexer.factor [new file with mode: 0644]

diff --git a/extra/benchmark/lexer/lexer.factor b/extra/benchmark/lexer/lexer.factor
new file mode 100644 (file)
index 0000000..d3ba6fa
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: io.encodings.ascii io.files kernel lexer math ;
+
+IN: benchmark.lexer
+
+: lexer-benchmark ( -- )
+    10,000 "vocab:math/math.factor" ascii file-lines [
+        <lexer> [ parse-token ] curry loop
+    ] curry times ;
+
+MAIN: lexer-benchmark