Skip to content

Instantly share code, notes, and snippets.

@Stantheman
Created January 2, 2015 17:26
Show Gist options
  • Save Stantheman/a1b5d1186f63b9e30492 to your computer and use it in GitHub Desktop.
Save Stantheman/a1b5d1186f63b9e30492 to your computer and use it in GitHub Desktop.
test perf between patched and unpatched go encoding/binary
#!/bin/bash
echo "Testing Original"
cp binary_orig.go.old binary.go
for i in {1..5}; do
go test -v -bench='[de]Ints' -run none | grep Read | tee /tmp/tmp.txt
done
echo "Original read ns/op average: $(tr -s ' ' < /tmp/tmp.txt | cut -d' ' -f3 | numaverage)"
echo "Testing Fixed"
cp fixed_binary.go.old binary.go
for i in {1..5}; do
go test -v -bench='[de]Ints' -run none | grep Read | tee /tmp/tmp.txt
done
echo "Fixed read ns/op average: $(tr -s ' ' < /tmp/tmp.txt | cut -d' ' -f3 | numaverage)"
rm /tmp/tmp.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment