-
Notifications
You must be signed in to change notification settings - Fork 1
/
test
executable file
·136 lines (131 loc) · 3.44 KB
/
test
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh
# tests with small sets
# perf tests should be done with variable set size
set -e
WORDS=/usr/share/dict/words
CC=cc
if [ -z "$CFLAGS" ]; then
CFLAGS="-O2 -g -fno-strict-aliasing"
MACHINE=$(uname -m)
if [ _$MACHINE = _x86_64 ]
then
CFLAGS="$CFLAGS -march=native"
fi
else
case "$CFLAGS" in
*-fsanitize=address*) ASAN=1; CFLAGS="$CFLAGS -DASAN" ;;
esac
fi
if [ -z "$1" ]
then
WORDSIN=_words1000
RANDIN=_rand100
[ -e ${WORDSIN} ] || head -n 1000 <${WORDS} >${WORDSIN}
[ -e ${RANDIN} ] || seq 200 | random > ${RANDIN}
else
echo Perf: $1
PERF=-DPERF
N=$1
N2=$(($N * 2))
WORDSIN=_words${N}
RANDIN=_rand${N2}
head -n $N <${WORDS} >${WORDSIN}
seq $N2 | random > ${RANDIN}
fi
perf() {
alg=$1
hash=$2
if [ -n "$3" ]; then
shift
shift
opts=$*
fi
map=
mapopt=
if [ x$alg = xbdz ]; then
map="${WORDSIN}.map"
mapopt="-m $map"
fi
# intkeys
if [ x$opts = x-I -o x$opts = x-Ip -o x$opts = x-Ifp -o x$opts = x-IM ]
then
if [ x$alg = xbdz ]
then
map="${RANDIN}.map"
mapopt="-m $map"
elif [ -z "$alg" ]
then
alg=chm
fi
echo ./nbperf $opts -a $alg -o _test_int$alg.c $mapopt ${RANDIN}
time ./nbperf $opts -a $alg -o _test_int$alg.c $mapopt ${RANDIN}
[ -z "$PERF" ] && echo $CC $CFLAGS -I. -D_INTKEYS -D$alg _test_int$alg.c test_main.c -o _test_int$alg
$CC $CFLAGS -I. $PERF -D_INTKEYS -D$alg _test_int$alg.c test_main.c -o _test_int$alg
echo ./_test_int$alg ${RANDIN}
time ./_test_int$alg ${RANDIN}
elif [ -z "$hash" ]
then
echo ./nbperf $opts -a $alg -o _test_${alg}.c $mapopt ${WORDSIN}
time ./nbperf $opts -a $alg -o _test_${alg}.c $mapopt ${WORDSIN}
[ -z "$PERF" ] && echo $CC $CFLAGS -I. -D$alg _test_${alg}.c test_main.c mi_vector_hash.c -o _test_${alg}
$CC $CFLAGS -I. $PERF -D$alg _test_${alg}.c test_main.c mi_vector_hash.c -o _test_${alg}
echo ./_test_${alg} ${WORDSIN}
time ./_test_${alg} ${WORDSIN}
else
echo ./nbperf $opts -a $alg -h $hash -o _test_${alg}_${hash}.c $mapopt ${WORDSIN}
time ./nbperf $opts -a $alg -h $hash -o _test_${alg}_${hash}.c $mapopt ${WORDSIN}
[ -z "$PERF" ] && echo $CC $CFLAGS -I. -D$alg -Dh_$hash _test_${alg}_${hash}.c test_main.c -o _test_${alg}_${hash}
$CC $CFLAGS -I. $PERF -D$alg -Dh_$hash _test_${alg}_${hash}.c test_main.c -o _test_${alg}_${hash}
echo ./_test_${alg}_${hash} ${WORDSIN}
time ./_test_${alg}_${hash} ${WORDSIN}
fi
}
perf chm
perf chm3
perf bdz
perf chm wyhash
perf chm3 wyhash
perf bdz wyhash
perf chm fnv
perf chm3 fnv
perf bdz fnv
perf chm fnv32
perf chm fnv16
perf chm crc
if [ -z $PERF]; then
perf chm "" -M
perf chm3 "" -M
perf chm "" -c -2
perf chm3 "" -c -2
perf bdz "" -c -2
perf bdz fnv -f
perf bdz fnv -fp
perf chm fnv32 -f
perf chm fnv32 -fp
perf chm crc -f
perf chm crc -fp
perf chm wyhash -f
perf chm3 wyhash -f
perf bdz wyhash -f
perf chm wyhash -M
perf chm3 wyhash -M
perf chm wyhash -fp
perf chm3 wyhash -fp
perf bdz wyhash -fp
perf chm wyhash -p
perf chm3 wyhash -p
perf bdz wyhash -p
fi
perf chm "" -I
perf chm3 "" -I
perf bdz "" -I
if [ -z $PERF]; then
perf chm "" -IM
perf chm3 "" -IM
perf chm "" -Ip
perf chm "" -Ifp
perf chm3 "" -Ip
perf chm3 "" -Ifp
perf bdz "" -Ip
perf bdz "" -Ifp
fi