|
@@ -81,7 +81,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
|
|
// Benchmark Encoding
|
|
// Benchmark Encoding
|
|
b.Run("Encode_"+bm.name, func(b *testing.B) {
|
|
b.Run("Encode_"+bm.name, func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
b.ReportAllocs()
|
|
- for i := 0; i < b.N; i++ {
|
|
|
|
|
|
+ for range b.N {
|
|
tokens, err := bpe.Encode(bm.input)
|
|
tokens, err := bpe.Encode(bm.input)
|
|
if err != nil {
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
b.Fatal(err)
|
|
@@ -99,7 +99,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
|
|
// Benchmark Decoding
|
|
// Benchmark Decoding
|
|
b.Run("Decode_"+bm.name, func(b *testing.B) {
|
|
b.Run("Decode_"+bm.name, func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
b.ReportAllocs()
|
|
- for i := 0; i < b.N; i++ {
|
|
|
|
|
|
+ for range b.N {
|
|
decoded, err := bpe.Decode(tokens)
|
|
decoded, err := bpe.Decode(tokens)
|
|
if err != nil {
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
b.Fatal(err)
|
|
@@ -148,7 +148,7 @@ func BenchmarkBytePairEncodingSplit(b *testing.B) {
|
|
for _, bm := range benchmarks {
|
|
for _, bm := range benchmarks {
|
|
b.Run("Split_"+bm.name, func(b *testing.B) {
|
|
b.Run("Split_"+bm.name, func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
b.ReportAllocs()
|
|
- for i := 0; i < b.N; i++ {
|
|
|
|
|
|
+ for range b.N {
|
|
splits, err := bpe.split(bm.input)
|
|
splits, err := bpe.split(bm.input)
|
|
if err != nil {
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
b.Fatal(err)
|