Skip to content

Commit

Permalink
ci/bench.sh: Benchmark masking on arm64 with QEMU
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Oct 20, 2023
1 parent 4cc3d0e commit 2a7cf1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ci/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ go test --run=^$ --bench=. --benchmem --memprofile ci/out/prof.mem --cpuprofile
(
cd ./internal/thirdparty
go test --run=^$ --bench=. --benchmem --memprofile ../../ci/out/prof-thirdparty.mem --cpuprofile ../../ci/out/prof-thirdparty.cpu -o ../../ci/out/thirdparty.test "$@" .

GOARCH=arm64 go test -c -o ../../ci/out/thirdparty-arm64.test .
qemu-aarch64 ../../ci/out/thirdparty-arm64.test --test.run=^$ --test.bench=Benchmark_mask --test.benchmem --test.memprofile ../../ci/out/prof-thirdparty-arm64.mem --test.cpuprofile ../../ci/out/prof-thirdparty-arm64.cpu .
)
5 changes: 5 additions & 0 deletions internal/thirdparty/frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package thirdparty

import (
"encoding/binary"
"runtime"
"strconv"
"testing"
_ "unsafe"
Expand Down Expand Up @@ -34,6 +35,10 @@ func nbioMaskBytes(b, key []byte) int
func gorillaMaskBytes(key [4]byte, pos int, b []byte) int

func Benchmark_mask(b *testing.B) {
b.Run(runtime.GOARCH, benchmark_mask)
}

func benchmark_mask(b *testing.B) {
sizes := []int{
8,
16,
Expand Down

0 comments on commit 2a7cf1b

Please sign in to comment.