File: timing.sh

package info (click to toggle)
lexd 1.3.5-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 880 kB
  • sloc: cpp: 2,889; makefile: 91; sh: 29
file content (37 lines) | stat: -rwxr-xr-x 565 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

if [ $# -gt 1 ]
then
  N=$1
  F=$2
else
  N="1"
  F=$1
fi

echo ""
echo "Timing comparison for language $F"
echo ""

cat "$F.sh2" | while read line
do
  echo $line
  /usr/bin/time -f "  time: %e seconds, maximum memory usage: %M KB" bash -c "for x in {1..$N}; do $line; done"
done

hfst-expand "$F.hfst" | sort > "$F.txt"
hfst-expand "${F}_d.hfst" | sort > "${F}_d.txt"

S=`diff "$F.txt" "${F}_d.txt"`

cat "$F.txt" | wc

rm *.hfst *.att

if [ -n "$S" ]
then
  diff "$F.txt" "${F}_d.txt"
  rm "$F.txt" "${F}_d.txt"
  exit 1
fi
rm "$F.txt" "${F}_d.txt"