mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
add benchmark (#207)
This commit is contained in:
@@ -2,6 +2,7 @@ package rtptime
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
@@ -12,3 +13,12 @@ func TestEncoder(t *testing.T) {
|
|||||||
ts := e.Encode(0)
|
ts := e.Encode(0)
|
||||||
require.Equal(t, uint32(12345), ts)
|
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)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user