]> gitweb.factorcode.org Git - factor.git/commitdiff
benchmark.parse-float: add a float parse benchmark.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 28 Mar 2013 18:41:57 +0000 (11:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 28 Mar 2013 18:41:57 +0000 (11:41 -0700)
extra/benchmark/parse-float/parse-float.factor [new file with mode: 0644]

diff --git a/extra/benchmark/parse-float/parse-float.factor b/extra/benchmark/parse-float/parse-float.factor
new file mode 100644 (file)
index 0000000..99f0511
--- /dev/null
@@ -0,0 +1,12 @@
+USING: kernel literals math.functions math.parser random
+sequences ;
+IN: benchmark.parse-float
+
+CONSTANT: test-floats $[ 100,000 random-units ]
+
+: parse-float-benchmark ( -- )
+    test-floats [
+        [ number>string string>number ] [ 1e-10 ~ t assert= ] bi
+    ] each ;
+
+MAIN: parse-float-benchmark