-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbench.f
48 lines (42 loc) · 1 KB
/
bench.f
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
needs math/doubles
needs os/shell
: spin 1000 0do noop loop ;
os [IF]
create governor 50 allot
" cpufreq-selector -g " governor place
" /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" open/r
dup pad 50 rot read pad swap governor +place close
: zoom " cpufreq-selector -g performance" shell spin ;
: unzoom governor count shell ;
[ELSE]
: zoom spin ;
: unzoom ;
[THEN]
:: unzoom cr ." Interrupted" cr bye ; is ctrl-c
~doubles
| benchmark code for Reva
: .ms 1000 /mod (.) type '. emit 3 '0 (p.r) type space ;
: fib ( x -- y )
dup 2 >if 1- dup fib
swap 1- fib + ;;
then drop 1 ;
create joe 0 ,
: dl 100000 0 do joe @ drop loop ;
: dltest 0 do dl loop ;
| fp test
: oldreva " revaver" find dup 0if 2drop 1 else 7 =if drop 1 else 0 then then ;
oldreva [IF]
: smr ;
: 500sines ;
[ELSE]
needs math/floats
~floats
: smr f0 5001 1 do i s>f fsin f+ loop ;
19 sigdig !
| cr ." smr (.27970133224749172): " smr f. cr
: 500sines 10000 1 do smr fdrop loop ;
[THEN]
include bench-common.f
.ver cr
zoom bench unzoom
bye