You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
963 B

  1. #!/bin/bash
  2. set -ex
  3. reference_ref=${1:-master}
  4. reference_git=${2:-.}
  5. if ! `hash benchstat 2>/dev/null`; then
  6. echo "Installing benchstat"
  7. go get golang.org/x/perf/cmd/benchstat
  8. fi
  9. tempdir=`mktemp -d /tmp/go-toml-benchmark-XXXXXX`
  10. ref_tempdir="${tempdir}/ref"
  11. ref_benchmark="${ref_tempdir}/benchmark-`echo -n ${reference_ref}|tr -s '/' '-'`.txt"
  12. local_benchmark="`pwd`/benchmark-local.txt"
  13. echo "=== ${reference_ref} (${ref_tempdir})"
  14. git clone ${reference_git} ${ref_tempdir} >/dev/null 2>/dev/null
  15. pushd ${ref_tempdir} >/dev/null
  16. git checkout ${reference_ref} >/dev/null 2>/dev/null
  17. go test -bench=. -benchmem | tee ${ref_benchmark}
  18. cd benchmark
  19. go test -bench=. -benchmem | tee -a ${ref_benchmark}
  20. popd >/dev/null
  21. echo ""
  22. echo "=== local"
  23. go test -bench=. -benchmem | tee ${local_benchmark}
  24. cd benchmark
  25. go test -bench=. -benchmem | tee -a ${local_benchmark}
  26. echo ""
  27. echo "=== diff"
  28. benchstat -delta-test=none ${ref_benchmark} ${local_benchmark}