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

Benchmark on 32K buffers, so we're less memory constrained #19

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ geomean 4.042Gi 14.22Gi +251.80% 39.49Gi
goos: darwin
goarch: arm64
pkg: github.com/bwesterb/go-and
│ naive │ purego │ asm
│ sec/op │ sec/op vs base │ sec/op vs base │
And-12 354.88µ ± 1% 84.98µ ± 1% -76.05% (p=0.000 n=10) 26.38µ ± 1% -92.57% (p=0.000 n=10)
Or-12 357.74µ ± 2% 84.90µ ± 2% -76.27% (p=0.000 n=10) 26.23µ ± 1% -92.67% (p=0.000 n=10)
Xor-12 365.42µ ± 3% 85.10µ ± 1% -76.71% (p=0.000 n=10) 26.38µ ± 1% -92.78% (p=0.000 n=10)
AndNot-12 358.92µ ± 1% 85.65µ ± 4% -76.14% (p=0.000 n=10) 26.47µ ± 0% -92.63% (p=0.000 n=10)
Memset-12 297.70µ ± 1% 80.65µ ± 1% -72.91% (p=0.000 n=10) 12.27µ ± 12% -95.88% (p=0.000 n=10)
Popcnt-12 293.81µ ± 1% 45.94µ ± 1% -84.36% (p=0.000 n=10) 11.42µ ± 1% -96.11% (p=0.000 n=10)
geomean 336.7µ 76.14µ -77.38% 20.19µ -94.00%

│ naive │ purego │ asm
│ B/s │ B/s vs base │ B/s vs base │
And-12 2.624Gi ± 1% 10.959Gi ± 1% +317.58% (p=0.000 n=10) 35.305Gi ± 1% +1245.28% (p=0.000 n=10)
Or-12 2.603Gi ± 2% 10.970Gi ± 2% +321.35% (p=0.000 n=10) 35.502Gi ± 1% +1263.65% (p=0.000 n=10)
Xor-12 2.549Gi ± 3% 10.944Gi ± 1% +329.42% (p=0.000 n=10) 35.309Gi ± 1% +1285.41% (p=0.000 n=10)
AndNot-12 2.595Gi ± 1% 10.873Gi ± 4% +319.04% (p=0.000 n=10) 35.183Gi ± 0% +1255.91% (p=0.000 n=10)
Memset-12 3.128Gi ± 1% 11.548Gi ± 1% +269.12% (p=0.000 n=10) 75.993Gi ± 13% +2329.13% (p=0.000 n=10)
Popcnt-12 3.170Gi ± 1% 20.271Gi ± 1% +539.48% (p=0.000 n=10) 81.560Gi ± 1% +2472.98% (p=0.000 n=10)
geomean 2.766Gi 12.23Gi +342.17% 46.14Gi +1568.02%
│ naive │ purego │ asm │
│ sec/op │ sec/op vs base │ sec/op vs base │
And-12 9891.5n ± 0% 2248.0n ± 1% -77.27% (p=0.000 n=10) 511.2n ± 1% -94.83% (p=0.000 n=10)
Or-12 9824.5n ± 1% 2267.5n ± 1% -76.92% (p=0.000 n=10) 511.2n ± 1% -94.80% (p=0.000 n=10)
Xor-12 9826.5n ± 0% 2232.0n ± 1% -77.29% (p=0.000 n=10) 509.8n ± 1% -94.81% (p=0.000 n=10)
AndNot-12 9928.5n ± 1% 2251.0n ± 1% -77.33% (p=0.000 n=10) 581.7n ± 0% -94.14% (p=0.000 n=10)
Memset-12 294.96µ ± 1% 79.18µ ± 2% -73.15% (p=0.000 n=10) 10.83µ ± 7% -96.33% (p=0.000 n=10)
Popcnt-12 288.90µ ± 1% 45.24µ ± 0% -84.34% (p=0.000 n=10) 11.30µ ± 0% -96.09% (p=0.000 n=10)
geomean 30.52µ 6.716µ -77.99% 1.455µ -95.23%

│ naive │ purego │ asm │
│ B/s │ B/s vs base │ B/s vs base │
And-12 3.013Gi ± 0% 13.256Gi ± 1% +339.97% (p=0.000 n=10) 58.297Gi ± 1% +1834.87% (p=0.000 n=10)
Or-12 3.033Gi ± 1% 13.144Gi ± 1% +333.30% (p=0.000 n=10) 58.303Gi ± 1% +1821.98% (p=0.000 n=10)
Xor-12 3.033Gi ± 0% 13.353Gi ± 1% +340.28% (p=0.000 n=10) 58.462Gi ± 1% +1827.64% (p=0.000 n=10)
AndNot-12 3.002Gi ± 1% 13.240Gi ± 1% +341.07% (p=0.000 n=10) 51.233Gi ± 0% +1606.77% (p=0.000 n=10)
Memset-12 3.157Gi ± 1% 11.761Gi ± 2% +272.50% (p=0.000 n=10) 86.041Gi ± 7% +2625.05% (p=0.000 n=10)
Popcnt-12 3.224Gi ± 1% 20.585Gi ± 0% +538.57% (p=0.000 n=10) 82.407Gi ± 0% +2456.30% (p=0.000 n=10)
geomean 3.076Gi 13.98Gi +354.43% 64.53Gi +1997.80%
```
24 changes: 12 additions & 12 deletions and_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestAndNot(t *testing.T) {

func BenchmarkAnd(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -111,7 +111,7 @@ func BenchmarkAnd(b *testing.B) {

func BenchmarkAndGeneric(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -123,7 +123,7 @@ func BenchmarkAndGeneric(b *testing.B) {

func BenchmarkAndNaive(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -135,7 +135,7 @@ func BenchmarkAndNaive(b *testing.B) {

func BenchmarkOr(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -147,7 +147,7 @@ func BenchmarkOr(b *testing.B) {

func BenchmarkOrGeneric(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -159,7 +159,7 @@ func BenchmarkOrGeneric(b *testing.B) {

func BenchmarkOrNaive(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -171,7 +171,7 @@ func BenchmarkOrNaive(b *testing.B) {

func BenchmarkXor(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -183,7 +183,7 @@ func BenchmarkXor(b *testing.B) {

func BenchmarkXorGeneric(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -195,7 +195,7 @@ func BenchmarkXorGeneric(b *testing.B) {

func BenchmarkXorNaive(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -207,7 +207,7 @@ func BenchmarkXorNaive(b *testing.B) {

func BenchmarkAndNot(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -219,7 +219,7 @@ func BenchmarkAndNot(b *testing.B) {

func BenchmarkAndNotGeneric(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand All @@ -231,7 +231,7 @@ func BenchmarkAndNotGeneric(b *testing.B) {

func BenchmarkAndNotNaive(b *testing.B) {
b.StopTimer()
size := 1000000
size := 32000
a := make([]byte, size)
bb := make([]byte, size)
b.SetBytes(int64(size))
Expand Down
Loading