mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-09 12:40:49 -04:00
media: Add a basic benchmark
This commit is contained in:
parent
18074d0c23
commit
4d24e2a326
@ -233,3 +233,26 @@ func TestDecodeTypes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkTypeOps(b *testing.B) {
|
||||
mt := MPEGType
|
||||
mts := DefaultTypes
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = mt.FullSuffix()
|
||||
_ = mt.IsZero()
|
||||
c, err := mt.MarshalJSON()
|
||||
if c == nil || err != nil {
|
||||
b.Fatal("failed")
|
||||
}
|
||||
_ = mt.String()
|
||||
_ = mt.Suffix()
|
||||
_ = mt.Suffixes
|
||||
_ = mt.Type()
|
||||
_ = mts.BySuffix("xml")
|
||||
_, _ = mts.GetByMainSubType("application", "xml")
|
||||
_, _ = mts.GetBySuffix("xml")
|
||||
_, _ = mts.GetByType("application")
|
||||
_, _ = mts.GetFirstBySuffix("xml")
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user