add benchmark (#207)

This commit is contained in:
Alessandro Ros
2023-03-18 16:45:21 +01:00
committed by GitHub
parent f0540b4eee
commit 1005b38ec5

View File

@@ -2,6 +2,7 @@ package rtptime
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
@@ -12,3 +13,12 @@ func TestEncoder(t *testing.T) {
ts := e.Encode(0)
require.Equal(t, uint32(12345), ts)
}
func BenchmarkEncoder(b *testing.B) {
for i := 0; i < b.N; i++ {
func() {
d := NewEncoder(90000, 0)
d.Encode(200 * time.Second)
}()
}
}