forked from benhoyt/countwords
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·102 lines (80 loc) · 3.51 KB
/
test.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
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
#!/usr/bin/env bash
set -e
cat kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt kjvbible.txt >kjvbible_x10.txt
echo Python simple
python3 simple.py <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Python optimized
python3 optimized.py <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Go simple
go build -o simple-go simple.go
./simple-go <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Go optimized
go build -o optimized-go optimized.go
./optimized-go <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Rust simple
cargo build --release --manifest-path rust/simple/Cargo.toml
./rust/simple/target/release/countwords <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Rust optimized
cargo build --release --manifest-path rust/optimized/Cargo.toml
./rust/optimized/target/release/countwords <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Rust optimized trie
cargo build --release --manifest-path rust/optimized-trie/Cargo.toml
./rust/optimized-trie/target/release/countwords <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Rust optimized custom hashmap
cargo build --release --manifest-path rust/optimized-customhashmap/Cargo.toml
./rust/optimized-customhashmap/target/release/countwords <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Rust bonus '(Unicode word segmentation)'
cargo build --release --manifest-path rust/bonus/Cargo.toml
./rust/bonus/target/release/countwords <kjvbible_x10.txt | python3 normalize.py >output.txt
# We don't test its output since it uses a different segmenter.
echo C++ simple
g++ -O2 simple.cpp -o simple-cpp
./simple-cpp <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo C++ optimized
g++ -O2 optimized.cpp -o optimized-cpp
./optimized-cpp <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo C simple
gcc -O2 simple.c -o simple-c
./simple-c <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo C optimized
gcc -O2 optimized.c -o optimized-c
./optimized-c <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo AWK simple
gawk -f simple.awk <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
if command -v mawk > /dev/null; then
echo AWK optimized
mawk -f optimized.awk <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
fi
if [ -x ../gforth/gforth-fast ]; then
echo Forth simple
../gforth/gforth-fast simple.fs <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Forth optimized
../gforth/gforth-fast optimized.fs <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt
fi
echo Unix shell simple
bash simple.sh <kjvbible_x10.txt | awk '{ print $2, $1 }' | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo Unix shell optimized
bash optimized.sh <kjvbible_x10.txt | awk '{ print $2, $1 }' | python3 normalize.py >output.txt
git diff --exit-code output.txt
echo C# simple
csc -optimize -out:simple-cs simple.cs
chmod +x simple-cs
./simple-cs <kjvbible_x10.txt | python3 normalize.py >output.txt
git diff --exit-code output.txt