Skip to content

Commit

Permalink
Add benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Dec 4, 2023
1 parent 9b87512 commit a7548a1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions speak_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package azuretts_test

import (
"testing"

"github.com/ringsaturn/azuretts"
)

func BenchmarkToXML(b *testing.B) {
speak := azuretts.NewSpeak(
azuretts.WithLanguage(azuretts.LanguageZhCN),
azuretts.WithVoiceName(azuretts.VoiceNameZhCNYunxiNeural),
azuretts.WithStyle(azuretts.StyleChat),
azuretts.WithRate(1),
azuretts.WithVoiceStyledegree(2),
azuretts.WithSpeechText("你好,世界"),
azuretts.WithVolume(100),
)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := speak.ToXML()
if err != nil {
b.Fatal(err)
}
}
}

0 comments on commit a7548a1

Please sign in to comment.