mirror of
https://github.com/ollama/ollama.git
synced 2025-11-10 13:57:00 +01:00
refactor: using testing.B.Loop
Signed-off-by: yajianggroup <yajianggroup@outlook.com>
This commit is contained in:
committed by
Michael Yang
parent
3d32249c74
commit
df411c4b02
@@ -251,7 +251,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
|
||||
bts := bts[:n]
|
||||
b.Run("encode"+strconv.Itoa(n), func(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
for range b.N {
|
||||
for b.Loop() {
|
||||
_, err := tokenizer.Encode(string(bts), true)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
@@ -266,7 +266,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
for range b.N {
|
||||
for b.Loop() {
|
||||
_, err := tokenizer.Decode(ids)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
@@ -276,7 +276,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
|
||||
|
||||
b.Run("split"+strconv.Itoa(n), func(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
for range b.N {
|
||||
for b.Loop() {
|
||||
slices.Collect(tokenizer.split(string(bts)))
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user