nydp 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +77 -56
- data/lib/lisp/core-000.nydp +1 -1
- data/lib/lisp/core-010-precompile.nydp +49 -29
- data/lib/lisp/core-012-utils.nydp +12 -8
- data/lib/lisp/core-015-documentation.nydp +41 -15
- data/lib/lisp/core-017-builtin-dox.nydp +621 -100
- data/lib/lisp/core-020-utils.nydp +33 -6
- data/lib/lisp/core-025-warnings.nydp +1 -1
- data/lib/lisp/core-030-syntax.nydp +64 -48
- data/lib/lisp/core-035-flow-control.nydp +20 -28
- data/lib/lisp/core-037-list-utils.nydp +84 -21
- data/lib/lisp/core-040-utils.nydp +8 -5
- data/lib/lisp/core-041-string-utils.nydp +17 -11
- data/lib/lisp/core-043-list-utils.nydp +140 -77
- data/lib/lisp/core-045-dox-utils.nydp +1 -0
- data/lib/lisp/core-050-test-runner.nydp +8 -12
- data/lib/lisp/core-070-prefix-list.nydp +19 -15
- data/lib/lisp/core-080-pretty-print.nydp +13 -5
- data/lib/lisp/core-090-hook.nydp +11 -11
- data/lib/lisp/core-100-utils.nydp +51 -66
- data/lib/lisp/core-110-hash-utils.nydp +34 -7
- data/lib/lisp/core-120-settings.nydp +14 -9
- data/lib/lisp/core-130-validations.nydp +28 -13
- data/lib/lisp/core-900-benchmarking.nydp +420 -47
- data/lib/lisp/tests/000-empty-args-examples.nydp +5 -0
- data/lib/lisp/tests/andify-examples.nydp +1 -1
- data/lib/lisp/tests/auto-hash-examples.nydp +6 -1
- data/lib/lisp/tests/best-examples.nydp +1 -1
- data/lib/lisp/tests/boot-tests.nydp +1 -1
- data/lib/lisp/tests/date-examples.nydp +129 -102
- data/lib/lisp/tests/destructuring-examples.nydp +1 -1
- data/lib/lisp/tests/dox-tests.nydp +2 -2
- data/lib/lisp/tests/hash-examples.nydp +58 -33
- data/lib/lisp/tests/list-tests.nydp +137 -1
- data/lib/lisp/tests/pretty-print-tests.nydp +12 -0
- data/lib/lisp/tests/rotate-2d-array-examples.nydp +26 -0
- data/lib/lisp/tests/sort-examples.nydp +5 -5
- data/lib/lisp/tests/string-tests.nydp +16 -5
- data/lib/lisp/tests/syntax-tests.nydp +10 -2
- data/lib/lisp/tests/time-examples.nydp +8 -1
- data/lib/lisp/tests/unparse-tests.nydp +13 -7
- data/lib/nydp/assignment.rb +15 -28
- data/lib/nydp/builtin/abs.rb +4 -3
- data/lib/nydp/builtin/apply.rb +8 -10
- data/lib/nydp/builtin/cdr_set.rb +1 -1
- data/lib/nydp/builtin/comment.rb +1 -3
- data/lib/nydp/builtin/date.rb +11 -28
- data/lib/nydp/builtin/divide.rb +3 -10
- data/lib/nydp/builtin/ensuring.rb +6 -21
- data/lib/nydp/builtin/error.rb +2 -4
- data/lib/nydp/builtin/eval.rb +9 -4
- data/lib/nydp/builtin/greater_than.rb +7 -8
- data/lib/nydp/builtin/handle_error.rb +10 -34
- data/lib/nydp/builtin/hash.rb +24 -45
- data/lib/nydp/builtin/inspect.rb +1 -3
- data/lib/nydp/builtin/is_equal.rb +4 -7
- data/lib/nydp/builtin/less_than.rb +6 -7
- data/lib/nydp/builtin/log.rb +7 -0
- data/lib/nydp/builtin/math_ceiling.rb +1 -3
- data/lib/nydp/builtin/math_floor.rb +1 -3
- data/lib/nydp/builtin/math_power.rb +1 -3
- data/lib/nydp/builtin/math_round.rb +2 -2
- data/lib/nydp/builtin/minus.rb +7 -14
- data/lib/nydp/builtin/parse.rb +5 -5
- data/lib/nydp/builtin/parse_in_string.rb +5 -7
- data/lib/nydp/builtin/plus.rb +14 -31
- data/lib/nydp/builtin/pre_compile.rb +1 -3
- data/lib/nydp/builtin/puts.rb +4 -8
- data/lib/nydp/builtin/quit.rb +1 -1
- data/lib/nydp/builtin/rand.rb +6 -11
- data/lib/nydp/builtin/random_string.rb +2 -4
- data/lib/nydp/builtin/rng.rb +25 -0
- data/lib/nydp/builtin/ruby_wrap.rb +27 -14
- data/lib/nydp/builtin/script_run.rb +1 -3
- data/lib/nydp/builtin/set_intersection.rb +3 -4
- data/lib/nydp/builtin/set_union.rb +3 -4
- data/lib/nydp/builtin/sort.rb +2 -7
- data/lib/nydp/builtin/string_match.rb +5 -13
- data/lib/nydp/builtin/string_replace.rb +2 -7
- data/lib/nydp/builtin/string_split.rb +3 -8
- data/lib/nydp/builtin/sym.rb +2 -9
- data/lib/nydp/builtin/thread_locals.rb +2 -2
- data/lib/nydp/builtin/time.rb +38 -44
- data/lib/nydp/builtin/times.rb +6 -15
- data/lib/nydp/builtin/to_integer.rb +8 -14
- data/lib/nydp/builtin/to_string.rb +2 -13
- data/lib/nydp/builtin/type_of.rb +10 -16
- data/lib/nydp/builtin/vm_info.rb +2 -10
- data/lib/nydp/builtin.rb +15 -37
- data/lib/nydp/compiler.rb +29 -19
- data/lib/nydp/cond.rb +95 -88
- data/lib/nydp/context_symbol.rb +11 -9
- data/lib/nydp/core.rb +74 -73
- data/lib/nydp/core_ext.rb +87 -26
- data/lib/nydp/date.rb +22 -19
- data/lib/nydp/error.rb +2 -3
- data/lib/nydp/function_invocation.rb +76 -289
- data/lib/nydp/helper.rb +18 -9
- data/lib/nydp/interpreted_function.rb +159 -25
- data/lib/nydp/lexical_context.rb +9 -8
- data/lib/nydp/lexical_context_builder.rb +1 -1
- data/lib/nydp/literal.rb +3 -7
- data/lib/nydp/loop.rb +72 -0
- data/lib/nydp/namespace.rb +52 -0
- data/lib/nydp/pair.rb +146 -50
- data/lib/nydp/parser.rb +9 -11
- data/lib/nydp/plugin.rb +88 -19
- data/lib/nydp/runner.rb +141 -23
- data/lib/nydp/symbol.rb +16 -26
- data/lib/nydp/symbol_lookup.rb +3 -2
- data/lib/nydp/tokeniser.rb +1 -1
- data/lib/nydp/truth.rb +2 -37
- data/lib/nydp/version.rb +1 -1
- data/lib/nydp.rb +33 -44
- data/nydp.gemspec +2 -1
- data/spec/date_spec.rb +26 -32
- data/spec/embedded_spec.rb +22 -22
- data/spec/error_spec.rb +12 -16
- data/spec/foreign_hash_spec.rb +21 -36
- data/spec/hash_non_hash_behaviour_spec.rb +12 -29
- data/spec/hash_spec.rb +36 -49
- data/spec/literal_spec.rb +6 -6
- data/spec/nydp_spec.rb +14 -14
- data/spec/pair_spec.rb +8 -8
- data/spec/parser_spec.rb +41 -37
- data/spec/rand_spec.rb +1 -4
- data/spec/spec_helper.rb +3 -3
- data/spec/string_atom_spec.rb +15 -16
- data/spec/symbol_spec.rb +27 -52
- data/spec/thread_local_spec.rb +23 -8
- data/spec/time_spec.rb +4 -10
- data/spec/tokeniser_spec.rb +10 -10
- metadata +25 -13
- data/lib/nydp/builtin/modulo.rb +0 -11
- data/lib/nydp/builtin/regexp.rb +0 -7
- data/lib/nydp/builtin/sqrt.rb +0 -7
- data/lib/nydp/builtin/string_pad_left.rb +0 -7
- data/lib/nydp/builtin/string_pad_right.rb +0 -7
- data/lib/nydp/hash.rb +0 -9
- data/lib/nydp/image_store.rb +0 -21
- data/lib/nydp/vm.rb +0 -129
|
@@ -1,5 +1,346 @@
|
|
|
1
1
|
(chapter-start 'core-benchmarking "utils for benchmarking / measuring performance improvements")
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
;; 2021-07-21 WITHOUT compile-to-ruby (ie ruby-call-stack but nydp AST objects
|
|
6
|
+
;; 2nd run, all browsers closed
|
|
7
|
+
;; sig conditionals : total 3.8646832879999997, average 0.3864683288 per run
|
|
8
|
+
;; sig opt 4 : total 4.566391762, average 0.45663917620000005 per run
|
|
9
|
+
;; sig opt 3 : total 4.203421262, average 0.4203421262 per run
|
|
10
|
+
;; sig opt 2 : total 3.8990449220000003, average 0.3899044922 per run
|
|
11
|
+
;; sig opt 1 : total 4.092550381, average 0.40925503809999997 per run
|
|
12
|
+
;; string concatenation : total 2.462801678, average 0.2462801678 per run
|
|
13
|
+
;; random string : total 4.846918843, average 0.4846918843 per run
|
|
14
|
+
|
|
15
|
+
;; 2021-07-21 with compile-to-ruby
|
|
16
|
+
;; 2nd run, all browsers closed
|
|
17
|
+
;; sig conditionals : total 1.829855451, average 0.1829855451 per run
|
|
18
|
+
;; sig opt 4 : total 1.6262486520000001, average 0.16262486520000002 per run
|
|
19
|
+
;; sig opt 3 : total 1.620743386, average 0.1620743386 per run
|
|
20
|
+
;; sig opt 2 : total 2.737928596, average 0.2737928596 per run
|
|
21
|
+
;; sig opt 1 : total 2.738305964, average 0.27383059639999996 per run
|
|
22
|
+
;; string concatenation : total 2.112036525, average 0.2112036525 per run
|
|
23
|
+
;; random string : total 4.692295929, average 0.4692295929 per run
|
|
24
|
+
|
|
25
|
+
;; 2021-07-18 initial state after ruby-vm (kill Nydp::VM, use loops instead of recursion)
|
|
26
|
+
|
|
27
|
+
;; ENABLED invocation optimisations, all browsers closed
|
|
28
|
+
;; sig opt 4 : total 4.541110850999999, average 0.4541110850999999 per run
|
|
29
|
+
;; sig opt 3 : total 4.233554706, average 0.42335547059999995 per run
|
|
30
|
+
;; sig opt 2 : total 3.8893162720000003, average 0.3889316272 per run
|
|
31
|
+
;; sig opt 1 : total 4.043861785000001, average 0.4043861785000001 per run
|
|
32
|
+
|
|
33
|
+
;; DISABLED invocation optimisations, all browsers closed
|
|
34
|
+
;; sig opt 4 : total 5.311701500000002, average 0.5311701500000001 per run
|
|
35
|
+
;; sig opt 3 : total 4.705393086000001, average 0.4705393086000001 per run
|
|
36
|
+
;; sig opt 2 : total 4.874784166000001, average 0.48747841660000013 per run
|
|
37
|
+
;; sig opt 1 : total 5.174885633, average 0.5174885632999999 per run
|
|
38
|
+
|
|
39
|
+
;; ENABLED cond optimisations, 2nd run, all browsers closed
|
|
40
|
+
;; 2nd run : sig conditionals : total 4.008352403999999, average 0.4008352403999999 per run
|
|
41
|
+
;; 3rd run : sig conditionals : total 4.009742814000001, average 0.4009742814000001 per run
|
|
42
|
+
|
|
43
|
+
;; NO cond optimisations, all browsers closed
|
|
44
|
+
;; 2nd run : sig conditionals : total 4.159752815, average 0.4159752815 per run
|
|
45
|
+
;; 3rd run : sig conditionals : total 4.0797304279999995, average 0.40797304279999996 per run
|
|
46
|
+
|
|
47
|
+
;; ENABLED cond optimisations, 2nd run, all browsers closed
|
|
48
|
+
;; ================================================
|
|
49
|
+
;; sig conditionals : total 4.165200359, average 0.4165200359 per run
|
|
50
|
+
;; sig opt 4 : total 4.835078564, average 0.4835078564 per run
|
|
51
|
+
;; sig opt 3 : total 4.428351295, average 0.4428351295 per run
|
|
52
|
+
;; sig opt 2 : total 3.9052602330000004, average 0.3905260233 per run
|
|
53
|
+
;; sig opt 1 : total 4.167876979000001, average 0.4167876979000001 per run
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
;; NO cond optimisations, 2nd run, all browsers closed
|
|
57
|
+
;; ================================================
|
|
58
|
+
;; sig conditionals : total 4.195927696, average 0.4195927696 per run
|
|
59
|
+
;; sig opt 4 : total 4.932003079, average 0.4932003079 per run
|
|
60
|
+
;; sig opt 3 : total 4.452767801000001, average 0.4452767801000001 per run
|
|
61
|
+
;; sig opt 2 : total 3.954285836999999, average 0.3954285836999999 per run
|
|
62
|
+
;; sig opt 1 : total 4.097334289, average 0.4097334289 per run
|
|
63
|
+
;; nil
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
;; ================================================
|
|
67
|
+
;; Benchmark: sig opt 1 - 10 runs of 100000 iterations each
|
|
68
|
+
;; took: 0.426503837 ms, 4.26503837e-06 ms per iteration
|
|
69
|
+
;; took: 0.413642331 ms, 4.13642331e-06 ms per iteration
|
|
70
|
+
;; took: 0.422597112 ms, 4.22597112e-06 ms per iteration
|
|
71
|
+
;; took: 0.418587151 ms, 4.18587151e-06 ms per iteration
|
|
72
|
+
;; took: 0.424305825 ms, 4.24305825e-06 ms per iteration
|
|
73
|
+
;; took: 0.41488239 ms, 4.1488239e-06 ms per iteration
|
|
74
|
+
;; took: 0.422100791 ms, 4.22100791e-06 ms per iteration
|
|
75
|
+
;; took: 0.422288266 ms, 4.22288266e-06 ms per iteration
|
|
76
|
+
;; took: 0.447425729 ms, 4.4742572899999995e-06 ms per iteration
|
|
77
|
+
;; took: 0.42137804 ms, 4.2137804e-06 ms per iteration
|
|
78
|
+
;; total 4.2337114719999995, average 0.42337114719999996 per run
|
|
79
|
+
;; ================================================
|
|
80
|
+
|
|
81
|
+
;; ================================================
|
|
82
|
+
;; Benchmark: sig opt 2 - 10 runs of 100000 iterations each
|
|
83
|
+
;; took: 0.390394571 ms, 3.90394571e-06 ms per iteration
|
|
84
|
+
;; took: 0.393454324 ms, 3.93454324e-06 ms per iteration
|
|
85
|
+
;; took: 0.393321497 ms, 3.933214970000001e-06 ms per iteration
|
|
86
|
+
;; took: 0.395412523 ms, 3.95412523e-06 ms per iteration
|
|
87
|
+
;; took: 0.396412323 ms, 3.9641232300000005e-06 ms per iteration
|
|
88
|
+
;; took: 0.389947137 ms, 3.89947137e-06 ms per iteration
|
|
89
|
+
;; took: 0.394602936 ms, 3.94602936e-06 ms per iteration
|
|
90
|
+
;; took: 0.391583985 ms, 3.91583985e-06 ms per iteration
|
|
91
|
+
;; took: 0.393477322 ms, 3.93477322e-06 ms per iteration
|
|
92
|
+
;; took: 0.396048008 ms, 3.96048008e-06 ms per iteration
|
|
93
|
+
;; total 3.9346546260000004, average 0.39346546260000004 per run
|
|
94
|
+
;; ================================================
|
|
95
|
+
|
|
96
|
+
;; ================================================
|
|
97
|
+
;; Benchmark: sig opt 3 - 10 runs of 1000 iterations each
|
|
98
|
+
;; took: 0.451705754 ms, 0.000451705754 ms per iteration
|
|
99
|
+
;; took: 0.455307888 ms, 0.000455307888 ms per iteration
|
|
100
|
+
;; took: 0.449316439 ms, 0.000449316439 ms per iteration
|
|
101
|
+
;; took: 0.455164749 ms, 0.00045516474899999997 ms per iteration
|
|
102
|
+
;; took: 0.450765149 ms, 0.000450765149 ms per iteration
|
|
103
|
+
;; took: 0.452652457 ms, 0.000452652457 ms per iteration
|
|
104
|
+
;; took: 0.453089724 ms, 0.00045308972400000003 ms per iteration
|
|
105
|
+
;; took: 0.450432394 ms, 0.000450432394 ms per iteration
|
|
106
|
+
;; took: 0.457052758 ms, 0.000457052758 ms per iteration
|
|
107
|
+
;; took: 0.454898091 ms, 0.000454898091 ms per iteration
|
|
108
|
+
;; total 4.530385403, average 0.4530385403 per run
|
|
109
|
+
;; ================================================
|
|
110
|
+
|
|
111
|
+
;; ================================================
|
|
112
|
+
;; Benchmark: sig opt 4 - 10 runs of 5000 iterations each
|
|
113
|
+
;; took: 0.495521834 ms, 9.910436679999999e-05 ms per iteration
|
|
114
|
+
;; took: 0.49755384 ms, 9.951076800000001e-05 ms per iteration
|
|
115
|
+
;; took: 0.552695865 ms, 0.000110539173 ms per iteration
|
|
116
|
+
;; took: 0.492433916 ms, 9.84867832e-05 ms per iteration
|
|
117
|
+
;; took: 0.494145933 ms, 9.882918659999999e-05 ms per iteration
|
|
118
|
+
;; took: 0.492996487 ms, 9.85992974e-05 ms per iteration
|
|
119
|
+
;; took: 0.497015332 ms, 9.94030664e-05 ms per iteration
|
|
120
|
+
;; took: 0.492309001 ms, 9.84618002e-05 ms per iteration
|
|
121
|
+
;; took: 0.494715669 ms, 9.89431338e-05 ms per iteration
|
|
122
|
+
;; took: 0.490812481 ms, 9.81624962e-05 ms per iteration
|
|
123
|
+
;; total 5.000200358, average 0.5000200358 per run
|
|
124
|
+
;; ================================================
|
|
125
|
+
|
|
126
|
+
;; ================================================
|
|
127
|
+
;; Benchmark: sig conditionals - 10 runs of 25000 iterations each
|
|
128
|
+
;; took: 0.431557899 ms, 1.726231596e-05 ms per iteration
|
|
129
|
+
;; took: 0.426571858 ms, 1.7062874320000002e-05 ms per iteration
|
|
130
|
+
;; took: 0.430284569 ms, 1.721138276e-05 ms per iteration
|
|
131
|
+
;; took: 0.42693517 ms, 1.70774068e-05 ms per iteration
|
|
132
|
+
;; took: 0.427953987 ms, 1.7118159479999998e-05 ms per iteration
|
|
133
|
+
;; took: 0.430319221 ms, 1.721276884e-05 ms per iteration
|
|
134
|
+
;; took: 0.426118186 ms, 1.704472744e-05 ms per iteration
|
|
135
|
+
;; took: 0.432150037 ms, 1.7286001479999998e-05 ms per iteration
|
|
136
|
+
;; took: 0.425839283 ms, 1.703357132e-05 ms per iteration
|
|
137
|
+
;; took: 0.430216539 ms, 1.720866156e-05 ms per iteration
|
|
138
|
+
;; total 4.2879467490000005, average 0.42879467490000006 per run
|
|
139
|
+
;; ================================================
|
|
140
|
+
;; sig conditionals : total 4.2879467490000005, average 0.42879467490000006 per run
|
|
141
|
+
;; sig opt 4 : total 5.000200358, average 0.5000200358 per run
|
|
142
|
+
;; sig opt 3 : total 4.530385403, average 0.4530385403 per run
|
|
143
|
+
;; sig opt 2 : total 3.9346546260000004, average 0.39346546260000004 per run
|
|
144
|
+
;; sig opt 1 : total 4.2337114719999995, average 0.42337114719999996 per run
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
;; ================================================
|
|
149
|
+
;; Benchmark: sig opt 1 - 10 runs of 100000 iterations each
|
|
150
|
+
;; took: 0.450890062 ms, 4.5089006199999994e-06 ms per iteration
|
|
151
|
+
;; took: 0.432765088 ms, 4.32765088e-06 ms per iteration
|
|
152
|
+
;; took: 0.434230634 ms, 4.3423063400000005e-06 ms per iteration
|
|
153
|
+
;; took: 0.434357508 ms, 4.34357508e-06 ms per iteration
|
|
154
|
+
;; took: 0.436309824 ms, 4.36309824e-06 ms per iteration
|
|
155
|
+
;; took: 0.433316817 ms, 4.33316817e-06 ms per iteration
|
|
156
|
+
;; took: 0.433160962 ms, 4.33160962e-06 ms per iteration
|
|
157
|
+
;; took: 0.436266355 ms, 4.36266355e-06 ms per iteration
|
|
158
|
+
;; took: 0.433903638 ms, 4.33903638e-06 ms per iteration
|
|
159
|
+
;; took: 0.433309169 ms, 4.33309169e-06 ms per iteration
|
|
160
|
+
;; total 4.358510057, average 0.4358510057 per run
|
|
161
|
+
;; ================================================
|
|
162
|
+
|
|
163
|
+
;; ================================================
|
|
164
|
+
;; Benchmark: sig opt 2 - 10 runs of 100000 iterations each
|
|
165
|
+
;; took: 0.406172146 ms, 4.06172146e-06 ms per iteration
|
|
166
|
+
;; took: 0.410655107 ms, 4.10655107e-06 ms per iteration
|
|
167
|
+
;; took: 0.429369977 ms, 4.29369977e-06 ms per iteration
|
|
168
|
+
;; took: 0.411830985 ms, 4.11830985e-06 ms per iteration
|
|
169
|
+
;; took: 0.408426065 ms, 4.08426065e-06 ms per iteration
|
|
170
|
+
;; took: 0.406196975 ms, 4.06196975e-06 ms per iteration
|
|
171
|
+
;; took: 0.408817666 ms, 4.0881766600000006e-06 ms per iteration
|
|
172
|
+
;; took: 0.405828419 ms, 4.05828419e-06 ms per iteration
|
|
173
|
+
;; took: 0.405799685 ms, 4.05799685e-06 ms per iteration
|
|
174
|
+
;; took: 0.409665169 ms, 4.09665169e-06 ms per iteration
|
|
175
|
+
;; total 4.102762193999999, average 0.4102762193999999 per run
|
|
176
|
+
;; ================================================
|
|
177
|
+
|
|
178
|
+
;; ================================================
|
|
179
|
+
;; Benchmark: sig opt 3 - 10 runs of 1000 iterations each
|
|
180
|
+
;; took: 0.453698393 ms, 0.000453698393 ms per iteration
|
|
181
|
+
;; took: 0.455538224 ms, 0.000455538224 ms per iteration
|
|
182
|
+
;; took: 0.457062157 ms, 0.000457062157 ms per iteration
|
|
183
|
+
;; took: 0.456968192 ms, 0.00045696819199999997 ms per iteration
|
|
184
|
+
;; took: 0.458888122 ms, 0.000458888122 ms per iteration
|
|
185
|
+
;; took: 0.458823928 ms, 0.000458823928 ms per iteration
|
|
186
|
+
;; took: 0.453924711 ms, 0.000453924711 ms per iteration
|
|
187
|
+
;; took: 0.471214934 ms, 0.000471214934 ms per iteration
|
|
188
|
+
;; took: 0.458353467 ms, 0.000458353467 ms per iteration
|
|
189
|
+
;; took: 0.465602218 ms, 0.000465602218 ms per iteration
|
|
190
|
+
;; total 4.590074346, average 0.4590074346 per run
|
|
191
|
+
;; ================================================
|
|
192
|
+
|
|
193
|
+
;; ================================================
|
|
194
|
+
;; Benchmark: sig opt 4 - 10 runs of 5000 iterations each
|
|
195
|
+
;; took: 0.500212815 ms, 0.000100042563 ms per iteration
|
|
196
|
+
;; took: 0.496506238 ms, 9.93012476e-05 ms per iteration
|
|
197
|
+
;; took: 0.496074053 ms, 9.921481060000001e-05 ms per iteration
|
|
198
|
+
;; took: 0.49651661 ms, 9.930332200000001e-05 ms per iteration
|
|
199
|
+
;; took: 0.497912166 ms, 9.95824332e-05 ms per iteration
|
|
200
|
+
;; took: 0.578322371 ms, 0.0001156644742 ms per iteration
|
|
201
|
+
;; took: 0.510024182 ms, 0.0001020048364 ms per iteration
|
|
202
|
+
;; took: 0.49581022 ms, 9.916204400000001e-05 ms per iteration
|
|
203
|
+
;; took: 0.49836314 ms, 9.9672628e-05 ms per iteration
|
|
204
|
+
;; took: 0.495195561 ms, 9.903911220000001e-05 ms per iteration
|
|
205
|
+
;; total 5.064937356000001, average 0.5064937356000001 per run
|
|
206
|
+
;; ================================================
|
|
207
|
+
|
|
208
|
+
;; ================================================
|
|
209
|
+
;; Benchmark: sig cond and - 10 runs of 800 iterations each
|
|
210
|
+
;; took: 0.478098974 ms, 0.0005976237175 ms per iteration
|
|
211
|
+
;; took: 0.477069456 ms, 0.00059633682 ms per iteration
|
|
212
|
+
;; took: 0.478260275 ms, 0.00059782534375 ms per iteration
|
|
213
|
+
;; took: 0.47783629 ms, 0.0005972953625 ms per iteration
|
|
214
|
+
;; took: 0.48105838 ms, 0.0006013229750000001 ms per iteration
|
|
215
|
+
;; took: 0.476168432 ms, 0.00059521054 ms per iteration
|
|
216
|
+
;; took: 0.477739359 ms, 0.00059717419875 ms per iteration
|
|
217
|
+
;; took: 0.484042839 ms, 0.00060505354875 ms per iteration
|
|
218
|
+
;; took: 0.487843433 ms, 0.00060980429125 ms per iteration
|
|
219
|
+
;; took: 0.475485017 ms, 0.00059435627125 ms per iteration
|
|
220
|
+
;; total 4.793602455, average 0.4793602455 per run
|
|
221
|
+
;; ================================================
|
|
222
|
+
;; sig cond and : total 4.793602455, average 0.4793602455 per run
|
|
223
|
+
;; sig opt 4 : total 5.064937356000001, average 0.5064937356000001 per run
|
|
224
|
+
;; sig opt 3 : total 4.590074346, average 0.4590074346 per run
|
|
225
|
+
;; sig opt 2 : total 4.102762193999999, average 0.4102762193999999 per run
|
|
226
|
+
;; sig opt 1 : total 4.358510057, average 0.4358510057 per run
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
;; ================================================
|
|
230
|
+
;; Benchmark: sig opt 1 - 10 runs of 100000 iterations each
|
|
231
|
+
;; took: 0.575892683 ms, 5.758926829999999e-06 ms per iteration
|
|
232
|
+
;; took: 0.537105537 ms, 5.37105537e-06 ms per iteration
|
|
233
|
+
;; took: 0.538311191 ms, 5.38311191e-06 ms per iteration
|
|
234
|
+
;; took: 0.543976664 ms, 5.43976664e-06 ms per iteration
|
|
235
|
+
;; took: 0.53516757 ms, 5.3516757e-06 ms per iteration
|
|
236
|
+
;; took: 0.539703213 ms, 5.3970321300000005e-06 ms per iteration
|
|
237
|
+
;; took: 0.547180394 ms, 5.471803939999999e-06 ms per iteration
|
|
238
|
+
;; took: 0.548641598 ms, 5.4864159800000005e-06 ms per iteration
|
|
239
|
+
;; took: 0.546513722 ms, 5.46513722e-06 ms per iteration
|
|
240
|
+
;; took: 0.545944 ms, 5.45944e-06 ms per iteration
|
|
241
|
+
;; total 5.458436572, average 0.5458436572 per run
|
|
242
|
+
;; ================================================
|
|
243
|
+
|
|
244
|
+
;; ================================================
|
|
245
|
+
;; Benchmark: sig opt 2 - 10 runs of 100000 iterations each
|
|
246
|
+
;; took: 0.51480253 ms, 5.1480252999999995e-06 ms per iteration
|
|
247
|
+
;; took: 0.513128265 ms, 5.13128265e-06 ms per iteration
|
|
248
|
+
;; took: 0.51480177 ms, 5.148017700000001e-06 ms per iteration
|
|
249
|
+
;; took: 0.51551997 ms, 5.1551997e-06 ms per iteration
|
|
250
|
+
;; took: 0.509997725 ms, 5.09997725e-06 ms per iteration
|
|
251
|
+
;; took: 0.545524793 ms, 5.45524793e-06 ms per iteration
|
|
252
|
+
;; took: 0.521997808 ms, 5.219978079999999e-06 ms per iteration
|
|
253
|
+
;; took: 0.513020251 ms, 5.1302025100000004e-06 ms per iteration
|
|
254
|
+
;; took: 0.518397573 ms, 5.18397573e-06 ms per iteration
|
|
255
|
+
;; took: 0.513850827 ms, 5.13850827e-06 ms per iteration
|
|
256
|
+
;; total 5.181041512, average 0.5181041512 per run
|
|
257
|
+
;; ================================================
|
|
258
|
+
|
|
259
|
+
;; ================================================
|
|
260
|
+
;; Benchmark: sig opt 3 - 10 runs of 1000 iterations each
|
|
261
|
+
;; took: 0.498506397 ms, 0.0004985063969999999 ms per iteration
|
|
262
|
+
;; took: 0.493703647 ms, 0.000493703647 ms per iteration
|
|
263
|
+
;; took: 0.504859137 ms, 0.000504859137 ms per iteration
|
|
264
|
+
;; took: 0.49425609 ms, 0.00049425609 ms per iteration
|
|
265
|
+
;; took: 0.499983229 ms, 0.000499983229 ms per iteration
|
|
266
|
+
;; took: 0.497676601 ms, 0.000497676601 ms per iteration
|
|
267
|
+
;; took: 0.50095158 ms, 0.00050095158 ms per iteration
|
|
268
|
+
;; took: 0.497156536 ms, 0.000497156536 ms per iteration
|
|
269
|
+
;; took: 0.501644945 ms, 0.000501644945 ms per iteration
|
|
270
|
+
;; took: 0.49730586 ms, 0.00049730586 ms per iteration
|
|
271
|
+
;; total 4.986044022, average 0.49860440219999996 per run
|
|
272
|
+
;; ================================================
|
|
273
|
+
|
|
274
|
+
;; ================================================
|
|
275
|
+
;; Benchmark: sig opt 4 - 10 runs of 5000 iterations each
|
|
276
|
+
;; took: 0.550266175 ms, 0.000110053235 ms per iteration
|
|
277
|
+
;; took: 0.538462067 ms, 0.0001076924134 ms per iteration
|
|
278
|
+
;; took: 0.542079009 ms, 0.0001084158018 ms per iteration
|
|
279
|
+
;; took: 0.53964453 ms, 0.000107928906 ms per iteration
|
|
280
|
+
;; took: 0.536724566 ms, 0.00010734491319999999 ms per iteration
|
|
281
|
+
;; took: 0.577451092 ms, 0.0001154902184 ms per iteration
|
|
282
|
+
;; took: 0.544880157 ms, 0.00010897603140000001 ms per iteration
|
|
283
|
+
;; took: 0.549302216 ms, 0.0001098604432 ms per iteration
|
|
284
|
+
;; took: 0.540363939 ms, 0.0001080727878 ms per iteration
|
|
285
|
+
;; took: 0.545993756 ms, 0.0001091987512 ms per iteration
|
|
286
|
+
;; total 5.465167506999999, average 0.5465167506999999 per run
|
|
287
|
+
;; ================================================
|
|
288
|
+
;; sig opt 4 : total 5.465167506999999, average 0.5465167506999999 per run
|
|
289
|
+
;; sig opt 3 : total 4.986044022, average 0.49860440219999996 per run
|
|
290
|
+
;; sig opt 2 : total 5.181041512, average 0.5181041512 per run
|
|
291
|
+
;; sig opt 1 : total 5.458436572, average 0.5458436572 per run
|
|
292
|
+
;; nil
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
;; ================================================
|
|
296
|
+
;; Benchmark: sig opt 1 - 10 runs of 100000 iterations each
|
|
297
|
+
;; took: 0.538973581 ms, 5.38973581e-06 ms per iteration
|
|
298
|
+
;; took: 0.531348816 ms, 5.3134881599999994e-06 ms per iteration
|
|
299
|
+
;; took: 0.565600737 ms, 5.65600737e-06 ms per iteration
|
|
300
|
+
;; took: 0.534819684 ms, 5.34819684e-06 ms per iteration
|
|
301
|
+
;; took: 0.536657152 ms, 5.36657152e-06 ms per iteration
|
|
302
|
+
;; took: 0.52856209 ms, 5.2856209e-06 ms per iteration
|
|
303
|
+
;; took: 0.528734358 ms, 5.28734358e-06 ms per iteration
|
|
304
|
+
;; took: 0.526918027 ms, 5.26918027e-06 ms per iteration
|
|
305
|
+
;; took: 0.532292993 ms, 5.32292993e-06 ms per iteration
|
|
306
|
+
;; took: 0.534837871 ms, 5.34837871e-06 ms per iteration
|
|
307
|
+
;; total 5.358745308999999, average 0.5358745308999999 per run
|
|
308
|
+
;; ================================================
|
|
309
|
+
|
|
310
|
+
;; ================================================
|
|
311
|
+
;; Benchmark: sig opt 2 - 10 runs of 100000 iterations each
|
|
312
|
+
;; took: 0.515825533 ms, 5.15825533e-06 ms per iteration
|
|
313
|
+
;; took: 0.512412581 ms, 5.12412581e-06 ms per iteration
|
|
314
|
+
;; took: 0.515675872 ms, 5.15675872e-06 ms per iteration
|
|
315
|
+
;; took: 0.519812429 ms, 5.19812429e-06 ms per iteration
|
|
316
|
+
;; took: 0.515804433 ms, 5.15804433e-06 ms per iteration
|
|
317
|
+
;; took: 0.515844402 ms, 5.1584440200000005e-06 ms per iteration
|
|
318
|
+
;; took: 0.512207609 ms, 5.12207609e-06 ms per iteration
|
|
319
|
+
;; took: 0.513890528 ms, 5.13890528e-06 ms per iteration
|
|
320
|
+
;; took: 0.515194419 ms, 5.151944189999999e-06 ms per iteration
|
|
321
|
+
;; took: 0.513272453 ms, 5.13272453e-06 ms per iteration
|
|
322
|
+
;; total 5.149940259, average 0.5149940259 per run
|
|
323
|
+
;; ================================================
|
|
324
|
+
|
|
325
|
+
;; ================================================
|
|
326
|
+
;; Benchmark: sig opt 3 - 10 runs of 1000 iterations each
|
|
327
|
+
;; took: 0.494206291 ms, 0.000494206291 ms per iteration
|
|
328
|
+
;; took: 0.490103847 ms, 0.000490103847 ms per iteration
|
|
329
|
+
;; took: 0.551380196 ms, 0.0005513801959999999 ms per iteration
|
|
330
|
+
;; took: 0.491522228 ms, 0.000491522228 ms per iteration
|
|
331
|
+
;; took: 0.498186612 ms, 0.000498186612 ms per iteration
|
|
332
|
+
;; took: 0.490628694 ms, 0.0004906286939999999 ms per iteration
|
|
333
|
+
;; took: 0.496565118 ms, 0.000496565118 ms per iteration
|
|
334
|
+
;; took: 0.491208812 ms, 0.000491208812 ms per iteration
|
|
335
|
+
;; took: 0.494697483 ms, 0.000494697483 ms per iteration
|
|
336
|
+
;; took: 0.492709838 ms, 0.000492709838 ms per iteration
|
|
337
|
+
;; total 4.991209119, average 0.49912091189999996 per run
|
|
338
|
+
;; ================================================
|
|
339
|
+
;; sig opt 3 : total 4.991209119, average 0.49912091189999996 per run
|
|
340
|
+
;; sig opt 2 : total 5.149940259, average 0.5149940259 per run
|
|
341
|
+
;; sig opt 1 : total 5.358745308999999, average 0.5358745308999999 per run
|
|
342
|
+
|
|
343
|
+
|
|
3
344
|
;; (def bm-cond ()
|
|
4
345
|
;; (if (< 3 5) "less" "more"))
|
|
5
346
|
|
|
@@ -147,8 +488,11 @@
|
|
|
147
488
|
;; (for i 1 10
|
|
148
489
|
;; (pre-compile (dox-src rbs))))
|
|
149
490
|
|
|
150
|
-
;; (def bm-
|
|
151
|
-
;;
|
|
491
|
+
;; (def bm-cond-and ()
|
|
492
|
+
;; (with (even? λn(eq? (mod n 2) 0)
|
|
493
|
+
;; triple? λn(eq? (mod n 3) 0)
|
|
494
|
+
;; big? λn(> n 10))
|
|
495
|
+
;; (select (andify even? triple? big?) (range -10 31))))
|
|
152
496
|
|
|
153
497
|
;; (def bm-hash-fill ()
|
|
154
498
|
;; (with (h {} v1 1 v2 2 v3 3 v4 4 v5 5 v6 6)
|
|
@@ -183,23 +527,6 @@
|
|
|
183
527
|
;; (z 0) (z 1) (z 2) (z 3) (z 4) (z 5) (z 6) (z 7) (z 8) (z 9)
|
|
184
528
|
;; (z 0) (z 1) (z 2) (z 3) (z 4) (z 5) (z 6) (z 7) (z 8) (z 9)))
|
|
185
529
|
|
|
186
|
-
(in-private
|
|
187
|
-
(def bm-no-closures ()
|
|
188
|
-
(list λ(+ 1 2)
|
|
189
|
-
λ(+ 1 2)
|
|
190
|
-
λ(+ 1 2)
|
|
191
|
-
λ(+ 1 2)
|
|
192
|
-
λ(+ 1 2)
|
|
193
|
-
λ(+ 1 2)
|
|
194
|
-
λ(+ 1 2)
|
|
195
|
-
λ(+ 1 2)
|
|
196
|
-
λ(+ 1 2)
|
|
197
|
-
λ(+ 1 2)))
|
|
198
|
-
|
|
199
|
-
(def bm-cons () (cons 'a 'b))
|
|
200
|
-
(def bm-type-of () (type-of 'a)))
|
|
201
|
-
|
|
202
|
-
|
|
203
530
|
|
|
204
531
|
;; ================================================
|
|
205
532
|
;; Benchmark: string concatenation - 10 runs of 20000 iterations each
|
|
@@ -216,18 +543,6 @@
|
|
|
216
543
|
;; total 7.228159722999999, average 0.7228159722999999 per run
|
|
217
544
|
;; ================================================
|
|
218
545
|
;; string concatenation : total 7.228159722999999, average 0.7228159722999999 per run
|
|
219
|
-
;; (def bm-string-concat ()
|
|
220
|
-
;; (+
|
|
221
|
-
;; (+ "this" "that" "another")
|
|
222
|
-
;; (+ "this" "that" "another")
|
|
223
|
-
;; (+ "this" "that" "another")
|
|
224
|
-
;; (+ "this" "that" "another")
|
|
225
|
-
;; (+ "this" "that" "another")
|
|
226
|
-
;; (+ "this" "that" "another")
|
|
227
|
-
;; (+ "this" "that" "another")
|
|
228
|
-
;; (+ "this" "that" "another")
|
|
229
|
-
;; (+ "this" "that" "another")
|
|
230
|
-
;; (+ "this" "that" "another")))
|
|
231
546
|
|
|
232
547
|
|
|
233
548
|
;; ================================================
|
|
@@ -246,20 +561,73 @@
|
|
|
246
561
|
;; ================================================
|
|
247
562
|
;; random string : total 6.954955385999999, average 0.6954955385999999 per run
|
|
248
563
|
|
|
249
|
-
;; (def bm-random-string ()
|
|
250
|
-
;; (list (random-string)
|
|
251
|
-
;; (random-string)
|
|
252
|
-
;; (random-string)
|
|
253
|
-
;; (random-string)
|
|
254
|
-
;; (random-string)
|
|
255
|
-
;; (random-string)
|
|
256
|
-
;; (random-string)
|
|
257
|
-
;; (random-string)
|
|
258
|
-
;; (random-string)
|
|
259
|
-
;; (random-string)))
|
|
260
564
|
|
|
565
|
+
|
|
566
|
+
(def bm-setup ()
|
|
567
|
+
(def bm-map-range () (with (a 1 b 10) (map (fn (n) (apply + (range 0 n))) (range a b))))
|
|
568
|
+
|
|
569
|
+
(def bm-accum () (accum a (each b (range 1 10) (a b))))
|
|
570
|
+
|
|
571
|
+
(def bm-sym-lex-lex-lex () (with (a 1 b 2 c 3) (+ a b c)))
|
|
572
|
+
|
|
573
|
+
(def bm-sym-lex-lit-lex () (with (a 1 c 3) (+ a 2 c)))
|
|
574
|
+
|
|
575
|
+
(def bm-conditionals ()
|
|
576
|
+
(with (a 1 b 2)
|
|
577
|
+
(list
|
|
578
|
+
(if (pair? a) (no a) a)
|
|
579
|
+
(if a (pair? a) t)
|
|
580
|
+
(if (and (pair? a) (no a) a)
|
|
581
|
+
(or a b)
|
|
582
|
+
(or b a))
|
|
583
|
+
(if a (pair? a) b))))
|
|
584
|
+
|
|
585
|
+
(in-private
|
|
586
|
+
(def bm-no-closures ()
|
|
587
|
+
(list λ(+ 1 2)
|
|
588
|
+
λ(+ 1 2)
|
|
589
|
+
λ(+ 1 2)
|
|
590
|
+
λ(+ 1 2)
|
|
591
|
+
λ(+ 1 2)
|
|
592
|
+
λ(+ 1 2)
|
|
593
|
+
λ(+ 1 2)
|
|
594
|
+
λ(+ 1 2)
|
|
595
|
+
λ(+ 1 2)
|
|
596
|
+
λ(+ 1 2)))
|
|
597
|
+
|
|
598
|
+
(def bm-cons () (cons 'a 'b))
|
|
599
|
+
(def bm-type-of () (type-of 'a)))
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
(def bm-string-concat ()
|
|
603
|
+
(+
|
|
604
|
+
(+ "this" "that" "another")
|
|
605
|
+
(+ "this" "that" "another")
|
|
606
|
+
(+ "this" "that" "another")
|
|
607
|
+
(+ "this" "that" "another")
|
|
608
|
+
(+ "this" "that" "another")
|
|
609
|
+
(+ "this" "that" "another")
|
|
610
|
+
(+ "this" "that" "another")
|
|
611
|
+
(+ "this" "that" "another")
|
|
612
|
+
(+ "this" "that" "another")
|
|
613
|
+
(+ "this" "that" "another")))
|
|
614
|
+
|
|
615
|
+
(def bm-random-string ()
|
|
616
|
+
(list (random-string)
|
|
617
|
+
(random-string)
|
|
618
|
+
(random-string)
|
|
619
|
+
(random-string)
|
|
620
|
+
(random-string)
|
|
621
|
+
(random-string)
|
|
622
|
+
(random-string)
|
|
623
|
+
(random-string)
|
|
624
|
+
(random-string)
|
|
625
|
+
(random-string)))
|
|
626
|
+
|
|
627
|
+
(assign bm-setup noop))
|
|
628
|
+
|
|
629
|
+
;; used in benchmarking
|
|
261
630
|
(def bm-repeat (f n)
|
|
262
|
-
; used in benchmarking
|
|
263
631
|
(for b 1 n (f)))
|
|
264
632
|
|
|
265
633
|
(def bm (desc f repeats iterations)
|
|
@@ -279,9 +647,10 @@
|
|
|
279
647
|
|
|
280
648
|
|
|
281
649
|
(def rbs (name)
|
|
650
|
+
(bm-setup)
|
|
282
651
|
(let summary nil
|
|
283
|
-
|
|
284
|
-
|
|
652
|
+
(push (bm "random string " bm-random-string 10 20000) summary)
|
|
653
|
+
(push (bm "string concatenation " bm-string-concat 10 20000) summary)
|
|
285
654
|
;; (push (bm "type-of " bm-type-of 10 20000) summary)
|
|
286
655
|
;; (push (bm "accum " bm-acc 10 500) summary)
|
|
287
656
|
;; (push (bm "accum " bm-facc 10 500) summary)
|
|
@@ -294,8 +663,12 @@
|
|
|
294
663
|
;; (push (bm "optimise DO forms " bm-faster-do 10 10000) summary)
|
|
295
664
|
;; (push (bm "length of string " bm-len-str 10 40000) summary)
|
|
296
665
|
;; (push (bm "length of pair " bm-len-pair 10 10000) summary)
|
|
297
|
-
|
|
298
|
-
|
|
666
|
+
(push (bm "sig opt 1" bm-sym-lex-lex-lex 10 100000) summary)
|
|
667
|
+
(push (bm "sig opt 2" bm-sym-lex-lit-lex 10 100000) summary)
|
|
668
|
+
(push (bm "sig opt 3" bm-map-range 10 1000) summary)
|
|
669
|
+
(push (bm "sig opt 4" bm-accum 10 5000) summary)
|
|
670
|
+
;; (push (bm "sig cond and" bm-cond-and 10 800) summary)
|
|
671
|
+
(push (bm "sig conditionals" bm-conditionals 10 25000) summary)
|
|
299
672
|
;; (push (bm "hashing" bm-hash-fill 10 5000) summary)
|
|
300
673
|
;; (push (bm "length of hash " bm-len-hash 10 15000) summary)
|
|
301
674
|
;; (push (bm "length of uncountable " bm-len-fn 10 50000) summary)
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
("builds a hash from the existing lexical context"
|
|
3
3
|
(with (a 1 b 2 c 3)
|
|
4
4
|
(to-string (auto-hash a b c)))
|
|
5
|
-
"{a=>1, b=>2, c=>3}")
|
|
5
|
+
"{:a=>1, :b=>2, :c=>3}")
|
|
6
|
+
|
|
7
|
+
("builds a hash using # prefix-syntax"
|
|
8
|
+
(with (d 2 e 4 f 6)
|
|
9
|
+
(to-string #(d e f)))
|
|
10
|
+
"{:d=>2, :e=>4, :f=>6}"))
|