Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use simd masking for amd64&arm64 #326

Merged
merged 26 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5df0303
mask.go: Use SIMD masking for amd64 and arm64
wdvxdr1123 Jan 24, 2022
cda2170
Refactor and compile masking code again
nhooyr Oct 19, 2023
f5397ae
mask_asm.go: Disable AVX2
nhooyr Oct 19, 2023
14172e5
Benchmark pure go masking algorithm separately from assembly
nhooyr Oct 19, 2023
685a56e
Update README.md to indicate assembly websocket masking
nhooyr Oct 19, 2023
cb7509a
mask_amd64.s: Remove AVX2 fully
nhooyr Oct 19, 2023
3f8c9e0
mask_amd64.s: Minor improvements
nhooyr Oct 19, 2023
367743d
mask_amd64.sh: Cleanup
nhooyr Oct 19, 2023
27f80cb
mask.go: Cleanup assembly and add nbio benchmark
nhooyr Oct 19, 2023
369d641
mask_arm64.s: Cleanup
nhooyr Oct 20, 2023
fb13df2
ci/bench.sh: Benchmark masking on arm64 with QEMU
nhooyr Oct 20, 2023
ecf7dec
ci/bench.sh: Install QEMU on CI
nhooyr Oct 20, 2023
d34e5d4
wsjson: Add json.Encoder vs json.Marshal benchmark
nhooyr Oct 20, 2023
e25d968
ci/bench.sh: Don't profile by default
nhooyr Oct 20, 2023
640e3c2
ci/bench.sh: Try function instead of alias
nhooyr Oct 20, 2023
0596e7a
wsjson: Extend benchmark with multiple sizes
nhooyr Oct 20, 2023
30447a3
ci/bench.sh: Just symlink the expected qemu-aarch64 binary name
nhooyr Oct 20, 2023
f4e61e5
ci/fmt.sh: Error if changes on CI
nhooyr Oct 21, 2023
f533f43
mask.go: Reorganize
nhooyr Oct 21, 2023
a1bb441
ci: Fix dev coverage output
nhooyr Feb 7, 2024
fee3739
mask_asm: Note implementation may not be perfect
nhooyr Feb 7, 2024
68fc887
mask.go: Revert my changes
nhooyr Feb 22, 2024
f62cef3
test.sh: Test assembly masking on arm64
nhooyr Feb 22, 2024
92acb74
internal/xcpu: Vendor golang.org/x/sys/cpu
nhooyr Feb 22, 2024
17e1b86
mask_asm: Disable AVX2
nhooyr Feb 22, 2024
2cd18b3
README.md: Link to assembly benchmark results
nhooyr Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci/bench.sh: Benchmark masking on arm64 with QEMU
  • Loading branch information
nhooyr committed Oct 26, 2023
commit fb13df2dc30520f64bd4daa167ed9c7e739a98b7
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