Skip to content

Commit

Permalink
Link against gmp,mpfr & enable PGO,LTO for up to 1.25x speedup
Browse files Browse the repository at this point in the history
PGO workload is taken from [here](https://github.com/Tensibai/benchmark-awk-vs)

**Benchmarking**

Use a different benchmark for testing to ensure we aren't just optimizing for one workload.

1. Generate some data
`yes 'SomeSampleText SomeOtherText 33 1970 YetAnotherText 777 abc 1 AndSomeMore' | head -12000000 > gawkdata.txt`

2. Benchmark
`perf stat -r 5 gawk 'BEGIN {a = 0;} /YetAnotherText/ {a ++;} END {print "a: " a;}' gawkdata.txt`

Before: 2.12259 +- 0.00260 seconds time elapsed  ( +-  0.12% )

After : 1.59791 +- 0.00152 seconds time elapsed  ( +-  0.10% )
  • Loading branch information
joebonrichie committed May 24, 2022
1 parent 736a818 commit b62808b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gawk/stone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description : |
upstreams :
- https://ftp.gnu.org/gnu/gawk/gawk-5.1.1.tar.xz: d87629386e894bbea11a5e00515fc909dc9b7249529dad9e6a3a2c77085f7ea2
builddeps :
- pkgconfig(gmp)
- pkgconfig(mpfr)
- make
- clang
- lld
Expand All @@ -25,3 +27,9 @@ install : |
%install_file %(installroot)/etc/profile.d/* -t %(installroot)/%(vendordir)/profile.d/
rm %(installroot)/etc/profile.d/*
rmdir %(installroot)/etc/profile.d %(installroot)/etc
workload : |
./gawk 'BEGIN{for (i=1;i<=10000000;i++) print (i % 5?"miss":"hit"),i," third\t \tfourth"}' > file
echo "/hit [[:digit:]]*0 / { print \$4, \$1, \$3 }" > test.awk
./gawk -f test.awk file | ./gawk '!seen[$0]++{unq++;r=$0} END{print ((unq==1) && (seen[r]==1000000) && (r=="fourth hit third")) ? "PASS" : "FAIL"}'
tuning :
- lto

0 comments on commit b62808b

Please sign in to comment.