Skip to content

Commit f5397ae

Browse files
committed
mask_asm.go: Disable AVX2
Slower for some reason than just SIMD. Also no dependency on cpu package is nice.
1 parent cda2170 commit f5397ae

File tree

5 files changed

+1
-11
lines changed

5 files changed

+1
-11
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module nhooyr.io/websocket
22

33
go 1.19
4-
5-
require golang.org/x/sys v0.13.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
2-
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

internal/examples/go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ require (
88
golang.org/x/time v0.3.0
99
nhooyr.io/websocket v0.0.0-00010101000000-000000000000
1010
)
11-
12-
require golang.org/x/sys v0.13.0 // indirect

internal/examples/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
2-
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
31
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
42
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

mask_asm.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
package websocket
44

5-
import "golang.org/x/sys/cpu"
6-
75
func mask(key uint32, b []byte) uint32 {
86
if len(b) > 0 {
97
return maskAsm(&b[0], len(b), key)
108
}
119
return key
1210
}
1311

14-
var useAVX2 = cpu.X86.HasAVX2 //lint:ignore U1000 mask_amd64.s
12+
var useAVX2 = false
1513

1614
//go:noescape
1715
func maskAsm(b *byte, len int, key uint32) uint32

0 commit comments

Comments
 (0)