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

diff --git a/extra/benchmark/namespaces/namespaces.factor b/extra/benchmark/namespaces/namespaces.factor
new file mode 100644 (file)
index 0000000..783f9a4
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: kernel math namespaces ;
+
+IN: benchmark.namespaces
+
+SYMBOL: foo
+SYMBOL: bar
+SYMBOL: baz
+
+: namespaces-benchmark ( -- )
+    200 [
+        123 foo [
+            200 [
+                456 bar [
+                    200 [
+                        789 baz [
+                            foo get 123 assert=
+                            bar get 456 assert=
+                            baz get 789 assert=
+                        ] with-variable
+                    ] times
+                ] with-variable
+            ] times
+        ] with-variable
+    ] times ;
+
+MAIN: namespaces-benchmark