Compare commits

..

1 Commits

Author SHA1 Message Date
bed69fbfd3 Add more benchmarks?
All checks were successful
Run Tests / Test (push) Successful in 25s
Benchmark BufferPool / RunBenchmarks (push) Successful in 28s
2024-07-24 11:32:09 +02:00
12 changed files with 21 additions and 212 deletions

View File

@@ -1,12 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 13663852 90.76 ns/op
BenchmarkBufferPoolManager_Concurrent-6 9525358 130.7 ns/op
BenchmarkBufferPoolManager_Memory-6 16205492 74.61 ns/op
BenchmarkEncodeWithBufferPool-6 8466584 143.2 ns/op
BenchmarkEncodeWithoutBufferPool-6 6701893 221.0 ns/op
BenchmarkDecodeBufferPool-6 7069999 162.3 ns/op
PASS
ok smpptester/pdu 8.413s

View File

@@ -1,12 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 16792826 71.92 ns/op
BenchmarkBufferPoolManager_Concurrent-6 9800792 127.2 ns/op
BenchmarkBufferPoolManager_Memory-6 13066466 79.52 ns/op
BenchmarkEncodeWithBufferPool-6 8162733 141.6 ns/op
BenchmarkEncodeWithoutBufferPool-6 6148492 272.3 ns/op
BenchmarkDecodeBufferPool-6 7300572 170.5 ns/op
PASS
ok smpptester/pdu 10.059s

View File

@@ -1,12 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 433611 2688 ns/op
BenchmarkBufferPoolManager_Concurrent-6 1467840 683.2 ns/op
BenchmarkBufferPoolManager_Memory-6 497097 2389 ns/op
BenchmarkEncode-6 8964351 148.5 ns/op
BenchmarkEncodeInto-6 371218869 2.987 ns/op
BenchmarkDecode-6 1000000000 0.2681 ns/op
PASS
ok smpptester/pdu 7.851s

View File

@@ -1,13 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 457300 2609 ns/op
BenchmarkBufferPoolManager_Concurrent-6 2050396 561.0 ns/op
BenchmarkBufferPoolManager_Memory-6 504205 2242 ns/op
BenchmarkEncode-6 27733428 44.06 ns/op
BenchmarkEncodeWithBufferPool-6 27795820 42.97 ns/op
BenchmarkEncodeInto-6 397897166 3.004 ns/op
BenchmarkDecode-6 1000000000 0.2653 ns/op
PASS
ok smpptester/pdu 10.935s

View File

@@ -1,27 +0,0 @@
? smpptester [no test files]
? smpptester/benchmark [no test files]
? smpptester/client [no test files]
goos: linux
goarch: amd64
pkg: smpptester/encoding
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkGSM7EncodeSimpleASCIIString-6 19589385 67.23 ns/op
BenchmarkGSM7EncodeComplexASCIIString-6 3757233 288.3 ns/op
BenchmarkGSM7EncodeComplex8nASCIIString-6 2576941 532.0 ns/op
BenchmarkGSM7EncodeComplex8nASCIIStringPrealloc-6 2611428 460.3 ns/op
PASS
ok smpptester/encoding 6.483s
? smpptester/lua [no test files]
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 16908814 71.62 ns/op
BenchmarkBufferPoolManager_Concurrent-6 8895826 125.1 ns/op
BenchmarkBufferPoolManager_Memory-6 13243089 80.48 ns/op
BenchmarkEncodeWithBufferPool-6 8433070 139.2 ns/op
BenchmarkEncodeWithoutBufferPool-6 7134577 248.2 ns/op
BenchmarkDecodeBufferPool-6 6587127 166.0 ns/op
PASS
ok smpptester/pdu 8.296s
? smpptester/server [no test files]

View File

@@ -1,27 +0,0 @@
? smpptester [no test files]
? smpptester/benchmark [no test files]
? smpptester/client [no test files]
goos: linux
goarch: amd64
pkg: smpptester/encoding
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkGSM7EncodeSimpleASCIIString-6 14935776 76.91 ns/op
BenchmarkGSM7EncodeComplexASCIIString-6 3364554 353.1 ns/op
BenchmarkGSM7EncodeComplex8nASCIIString-6 1840044 591.6 ns/op
BenchmarkGSM7EncodeComplex8nASCIIStringPrealloc-6 2081725 520.4 ns/op
PASS
ok smpptester/encoding 6.270s
? smpptester/lua [no test files]
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 16804492 75.91 ns/op
BenchmarkBufferPoolManager_Concurrent-6 11214482 134.8 ns/op
BenchmarkBufferPoolManager_Memory-6 15180892 71.99 ns/op
BenchmarkEncodeWithBufferPool-6 8587657 139.1 ns/op
BenchmarkEncodeWithoutBufferPool-6 5282655 223.4 ns/op
BenchmarkDecodeBufferPool-6 6659464 170.4 ns/op
PASS
ok smpptester/pdu 10.264s
? smpptester/server [no test files]

View File

@@ -1,27 +0,0 @@
? smpptester [no test files]
? smpptester/benchmark [no test files]
? smpptester/client [no test files]
goos: linux
goarch: amd64
pkg: smpptester/encoding
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkGSM7EncodeSimpleASCIIString-6 17371128 63.88 ns/op
BenchmarkGSM7EncodeComplexASCIIString-6 4210346 332.9 ns/op
BenchmarkGSM7EncodeComplex8nASCIIString-6 2748054 517.4 ns/op
BenchmarkGSM7EncodeComplex8nASCIIStringPrealloc-6 2576667 469.9 ns/op
PASS
ok smpptester/encoding 6.462s
? smpptester/lua [no test files]
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 16765892 70.02 ns/op
BenchmarkBufferPoolManager_Concurrent-6 9238833 119.7 ns/op
BenchmarkBufferPoolManager_Memory-6 15343066 75.22 ns/op
BenchmarkEncodeWithBufferPool-6 8445075 139.0 ns/op
BenchmarkEncodeWithoutBufferPool-6 5464392 274.3 ns/op
BenchmarkDecodeBufferPool-6 6709528 165.3 ns/op
PASS
ok smpptester/pdu 8.739s
? smpptester/server [no test files]

View File

@@ -1,27 +0,0 @@
? smpptester [no test files]
? smpptester/benchmark [no test files]
? smpptester/client [no test files]
goos: linux
goarch: amd64
pkg: smpptester/encoding
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkGSM7EncodeSimpleASCIIString-6 18785672 65.00 ns/op
BenchmarkGSM7EncodeComplexASCIIString-6 4313766 332.7 ns/op
BenchmarkGSM7EncodeComplex8nASCIIString-6 2686035 520.9 ns/op
BenchmarkGSM7EncodeComplex8nASCIIStringPrealloc-6 2613550 461.0 ns/op
PASS
ok smpptester/encoding 6.548s
? smpptester/lua [no test files]
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 16675815 69.97 ns/op
BenchmarkBufferPoolManager_Concurrent-6 9622903 120.8 ns/op
BenchmarkBufferPoolManager_Memory-6 15080410 84.43 ns/op
BenchmarkEncodeWithBufferPool-6 8589709 138.9 ns/op
BenchmarkEncodeWithoutBufferPool-6 6965332 228.4 ns/op
BenchmarkDecodeBufferPool-6 7003172 165.4 ns/op
PASS
ok smpptester/pdu 8.384s
? smpptester/server [no test files]

View File

@@ -1,12 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 15687109 91.05 ns/op
BenchmarkBufferPoolManager_Concurrent-6 11083287 128.9 ns/op
BenchmarkBufferPoolManager_Memory-6 16576201 74.12 ns/op
BenchmarkEncodeWithBufferPool-6 7868800 138.1 ns/op
BenchmarkEncodeWithoutBufferPool-6 6833810 221.2 ns/op
BenchmarkDecodeBufferPool-6 7195328 166.0 ns/op
PASS
ok smpptester/pdu 8.763s

View File

@@ -1,12 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 14983336 90.65 ns/op
BenchmarkBufferPoolManager_Concurrent-6 10671728 124.4 ns/op
BenchmarkBufferPoolManager_Memory-6 16471220 75.06 ns/op
BenchmarkEncodeWithBufferPool-6 8545360 139.1 ns/op
BenchmarkEncodeWithoutBufferPool-6 6794032 224.7 ns/op
BenchmarkDecodeBufferPool-6 6737445 165.3 ns/op
PASS
ok smpptester/pdu 8.681s

View File

@@ -1,28 +0,0 @@
? smpptester [no test files]
? smpptester/benchmark [no test files]
? smpptester/client [no test files]
goos: linux
goarch: amd64
pkg: smpptester/encoding
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkGSM7EncodeSimpleASCIIString-6 17190692 63.88 ns/op
BenchmarkGSM7EncodeComplexASCIIString-6 3987712 302.8 ns/op
BenchmarkGSM7EncodeComplex8nASCIIString-6 2563090 523.2 ns/op
BenchmarkGSM7EncodeComplex8nASCIIStringPrealloc-6 2615463 462.5 ns/op
PASS
ok smpptester/encoding 6.235s
? smpptester/lua [no test files]
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 16913668 70.22 ns/op
BenchmarkBufferPoolManager_Concurrent-6 9289608 129.8 ns/op
BenchmarkBufferPoolManager_Memory-6 13000988 83.78 ns/op
BenchmarkEncodeWithBufferPool-6 7950153 137.7 ns/op
BenchmarkEncodeWithoutBufferPool-6 6290456 172.9 ns/op
BenchmarkDecodeBufferPool-6 7194349 162.7 ns/op
PASS
ok smpptester/pdu 7.717s
? smpptester/server [no test files]
? smpptester/utils [no test files]

View File

@@ -292,7 +292,6 @@ func TestEncodeIntoWithBoundaryValues(t *testing.T) {
} }
} }
// region decode // region decode
func TestDecodeHandlesShortByteSlice(t *testing.T) { func TestDecodeHandlesShortByteSlice(t *testing.T) {
var p PDU_HEADER var p PDU_HEADER
@@ -463,7 +462,26 @@ func BenchmarkEncode(b *testing.B) {
} }
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
p.Encode() buf, _ := p.Encode()
ByteBufferPool.Put(buf)
}
}
// These two are effectively the same but there is difference in execution time
// I wonder why...
// I should stop writing benchmarks...
func BenchmarkEncodeWithBufferPool(b *testing.B) {
p := &PDU_HEADER{
command_length: 16,
command_id: 1,
command_status: 0,
sequence_number: 12345,
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
buf := ByteBufferPool.Get(uint(p.Size()))
p.EncodeInto(buf)
ByteBufferPool.Put(buf)
} }
} }
@@ -489,4 +507,4 @@ func BenchmarkDecode(b *testing.B) {
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
p.Decode(data) p.Decode(data)
} }
} }