Compare commits

...

4 Commits

Author SHA1 Message Date
0b51f373d5 Merge branch 'master' into benchmark 2024-07-24 11:24:09 +02:00
deb5175f94 Remove old benchmarks 2024-07-24 11:24:06 +02:00
7faa683237 Print first date then commit hash for benchmark results
All checks were successful
Run Tests / Test (push) Successful in 24s
Benchmark BufferPool / RunBenchmarks (push) Successful in 26s
2024-07-24 11:16:57 +02:00
3d7702f1c6 Add pdu benchmarks
All checks were successful
Run Tests / Test (push) Successful in 29s
Benchmark BufferPool / RunBenchmarks (push) Successful in 35s
2024-07-24 11:15:35 +02:00
5 changed files with 41 additions and 31 deletions

View File

@@ -31,7 +31,7 @@ func main() {
}
now := time.Now().Format(time.DateOnly)
resultFile := path.Join(".", "results", head+"_"+now+".txt")
resultFile := path.Join(".", "results", now+"_"+head+".txt")
log.Printf("Writing results to %s", resultFile)
outFile, err := os.Create(resultFile)
if err != nil {

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 475929 2495 ns/op
BenchmarkBufferPoolManager_Concurrent-6 2278720 518.3 ns/op
BenchmarkBufferPoolManager_Memory-6 512766 2334 ns/op
BenchmarkEncode-6 8457019 141.4 ns/op
BenchmarkEncodeInto-6 396452034 2.999 ns/op
BenchmarkDecode-6 1000000000 0.2644 ns/op
PASS
ok smpptester/pdu 8.814s

View File

@@ -1,9 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 451912 2327 ns/op
BenchmarkBufferPoolManager_Concurrent-6 2492938 475.8 ns/op
BenchmarkBufferPoolManager_Memory-6 526594 2275 ns/op
PASS
ok smpptester/pdu 4.062s

View File

@@ -1,9 +0,0 @@
goos: linux
goarch: amd64
pkg: smpptester/pdu
cpu: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
BenchmarkBufferPoolManager-6 451069 2297 ns/op
BenchmarkBufferPoolManager_Concurrent-6 2471343 482.9 ns/op
BenchmarkBufferPoolManager_Memory-6 576630 2408 ns/op
PASS
ok smpptester/pdu 5.321s

View File

@@ -450,3 +450,43 @@ func TestSizeReturns16(t *testing.T) {
t.Errorf("Expected size to be 16, got %d", p.Size())
}
}
// region benchmarks
// With buffer pool
func BenchmarkEncode(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++ {
p.Encode()
}
}
// Without buffer pool
func BenchmarkEncodeInto(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 := make([]uint8, 16)
p.EncodeInto(&buf)
}
}
func BenchmarkDecode(b *testing.B) {
p := &PDU_HEADER{}
data := []uint8{0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3}
b.ResetTimer()
for i := 0; i < b.N; i++ {
p.Decode(data)
}
}