-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare.art
107 lines (96 loc) · 2.81 KB
/
prepare.art
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
KeepOnly: []
if positive? size arg [
KeepOnly: split.by:"," arg\0
]
canExecute?: function [scri][
scr: extract.filename scri
if positive? size KeepOnly [
loop KeepOnly 'ko [
if contains? scr ko -> return true
]
return false
]
if sys\release='mini [
if in? scr [
"runtime.NumberOutOfPermittedRange"
"branching"
"sorting"
"ackermann function"
"arbitrary-precision integers - included"
"curzon numbers"
"iban"
"integer overflow"
"integer roots"
"jacobsthal numbers"
"long multiplication"
"loops - continue"
"lucas-lehmer test"
"modular exponentation"
"next special primes"
"sorting algorithms - cycle sort"
"sorting algorithms - pancake sort"
"sylvester's sequence"
"trigonometric functions"
"ultra useful primes"
"unicode strings"
"wieferich primes"
"xml - input"
] -> return false
]
if sys\release='full [
if in? scr [
"runtime.IntegerOperationOverflow"
"runtime.IntegerParsingOverflow"
] -> return false
]
return true
]
getMicroList: function [location][
map select list location 'loc [
canExecute? loc
] 'item [
ii: item
ii: replace ii "'" {\'}
ii: replace ii " " {:\ :}
ii: replace ii "(" {:\(:}
ii: replace ii ")" {:\):}
~{"arturo |ii|"}
]
]
getMacroList: function [location][
map select sort select list relative location 'loc -> contains? loc ".res" 'll [
canExecute? replace ll ".res" ".art"
] 'item [
ii: replace item ".res" ".art"
ii: replace ii "'" {\'}
ii: replace ii " " {:\ :}
ii: replace ii "(" {:\(:}
ii: replace ii ")" {:\):}
~{"arturo |ii|"}
]
]
prepareCommand: function [str, what][
"#!/usr/bin/env bash\n\n" ++
"hyperfine " ++
;"--warmup 1 " ++
"--time-unit millisecond " ++
;"--max-runs $1 " ++
"--ignore-failure " ++
(~"--export-json |what|.json ") ++
(~"--export-markdown |what|.md ") ++
;((sys\os="linux")? ->"--prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches'" ->"") ++ " " ++
str
]
micro: prepareCommand
join.with:" " sort
(getMicroList "tests/parsing") ++
(getMicroList "tests/core") ++
flatten map sort filter list "tests/library" 'l [contains? l "."] => getMicroList
'micro
macro: prepareCommand
join.with:" " sort
(getMacroList "../arturo/tests/unittests") ++
(getMacroList "../arturo/examples/rosetta")
'macro
write "micro.cmd" micro
write "macro.cmd" macro