-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeasure.sh
executable file
·50 lines (35 loc) · 1.26 KB
/
measure.sh
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
#!/bin/bash
get_size() {
size src/picovm.o | sed -n 2p | cut -f1
}
out=$'| | Code size |
|-----------------------|:-------------:|
'
make -C ./src clean > /dev/null
cp ./src/config.h /tmp/measure-config.h.bak
cp ./src/config_example.h ./src/config.h
make -C ./src measure > /dev/null
out+="| Full features | $(get_size) bytes |
"
make -C ./src clean > /dev/null
sed -i -e 's/#define INCLUDE_FLOATING_POINT_INSTRUCTIONS//g' ./src/config.h
make -C ./src measure > /dev/null
out+="| - floating point | $(get_size) bytes |
"
make -C ./src clean > /dev/null
sed -i -e 's/USE_SINGLE_DATA_TYPE 0/USE_SINGLE_DATA_TYPE 32/g' ./src/config.h
make -C ./src measure > /dev/null
out+="| - Single integer type | $(get_size) bytes |
"
make -C ./src clean > /dev/null
sed -i -e 's/#define INCLUDE_BITWISE_INSTRUCTIONS//g' ./src/config.h
make -C ./src measure > /dev/null
out+="| - Bitwise operations | $(get_size) bytes |
"
make -C ./src clean > /dev/null
sed -i -e 's/#define INCLUDE_OPTIONAL_INSTRUCTIONS//g' ./src/config.h
make -C ./src measure > /dev/null
mv /tmp/measure-config.h.bak ./src/config.h
out+="| - Advanced operations | $(get_size) bytes |"
f=`perl -p0e 's/\|.*\|/__table__/se' README.md`
echo "${f/__table__/$out}" > README.md