Skip to content

Commit 5311ab1

Browse files
committed
Build with PGO - it's more than 5% faster
We can probably get a more realistic PGO profile than just running the microbenchmarks, but it'll do. goawk=go1.21.0 with PGO orig =go1.21.0 without PGO Test | goawk | orig | awk ---------------------------- | -------- | -------- | -------- tt.01 (print) | 3.02 | 2.76 | 1.00 tt.02 (print NR NF) | 2.07 | 1.95 | 1.00 tt.02a (print length) | 1.85 | 1.80 | 1.00 tt.03 (sum length) | 1.53 | 1.47 | 1.00 tt.03a (sum field) | 1.47 | 1.44 | 1.00 tt.04 (printf fields) | 1.36 | 1.21 | 1.00 tt.05 (concat fields) | 1.54 | 1.48 | 1.00 tt.06 (count lengths) | 1.64 | 1.55 | 1.00 tt.07 (even fields) | 1.49 | 1.43 | 1.00 tt.08 (even lengths) | 2.54 | 2.60 | 1.00 tt.08z (regex simple) | 3.73 | 3.71 | 1.00 tt.09 (regex starts with) | 2.87 | 2.83 | 1.00 tt.10 (regex ends with) | 0.47 | 0.45 | 1.00 tt.10a (regex ends with var) | 0.45 | 0.44 | 1.00 tt.11 (substr) | 3.35 | 3.16 | 1.00 tt.12 (update fields) | 1.53 | 1.51 | 1.00 tt.13 (array ops) | 4.84 | 4.28 | 1.00 tt.13a (array printf) | 3.03 | 2.83 | 1.00 tt.14 (function call) | 1.73 | 1.50 | 1.00 tt.15 (format lines) | 1.00 | 0.97 | 1.00 tt.16 (count words) | 1.92 | 1.77 | 1.00 tt.big (complex program) | 2.29 | 2.17 | 1.00 tt.x1 (mandelbrot) | 2.68 | 2.67 | 1.00 tt.x2 (sum loop) | 2.41 | 2.19 | 1.00 ---------------------------- | -------- | -------- | -------- **Geo mean** | **1.86** | **1.76** | **1.00**
1 parent 3f54817 commit 5311ab1

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ goawk_*.tar.gz
1313
interp/testdata
1414
scripts/csvbench/bin
1515
scripts/csvbench/count.csv
16+
/default.pgo

scripts/make_binaries.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/sh
22

3+
# Create PGO profile
4+
go test -run=^$ -bench=. -cpuprofile=default.pgo ./interp
5+
36
go build
47
VERSION="$(./goawk -version)"
58

0 commit comments

Comments
 (0)