Skip to content

Instantly share code, notes, and snippets.

@Stantheman
Created January 2, 2015 17:26
Show Gist options
  • Select an option

  • Save Stantheman/a1b5d1186f63b9e30492 to your computer and use it in GitHub Desktop.

Select an option

Save Stantheman/a1b5d1186f63b9e30492 to your computer and use it in GitHub Desktop.

Revisions

  1. Stantheman created this gist Jan 2, 2015.
    17 changes: 17 additions & 0 deletions test.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/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