Skip to content
Snippets Groups Projects
Commit aae72890 authored by Christoph Petrausch's avatar Christoph Petrausch
Browse files

Added benchmark

parent c3e245ca
No related branches found
No related tags found
No related merge requests found
package packet
import (
"fmt"
"strconv"
"strings"
"testing"
)
func BenchmarkParseLargeCommunityString(b *testing.B) {
for _, i := range []int{1, 2, 4, 8, 16, 32} {
str := getNNumbers(i)
input := strings.Join([]string{str, str, str}, ",")
b.Run(fmt.Sprintf("BenchmarkParseLargeCommunityString-%d", i), func(b *testing.B) {
for n := 0; n < b.N; n++ {
ParseLargeCommunityString(input)
}
})
}
}
func getNNumbers(n int) (ret string) {
var numbers string
for i := 0; i < n; i++ {
numbers += strconv.Itoa(i % 10)
}
return numbers
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment