Remove benchmarks

This commit is contained in:
Evan Fiordeliso 2023-11-12 16:54:04 -05:00
parent 0518fee98e
commit a06e83f96a
3 changed files with 0 additions and 56 deletions

2
go.mod
View File

@ -1,5 +1,3 @@
module go.fifitido.net/cmd module go.fifitido.net/cmd
go 1.21.3 go 1.21.3
require github.com/spf13/pflag v1.0.5 // Used by opts/benchmarks_test.go

2
go.sum
View File

@ -1,2 +0,0 @@
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=

View File

@ -1,52 +0,0 @@
package opts_test
import (
"flag"
"testing"
"github.com/spf13/pflag"
"go.fifitido.net/cmd/opts"
)
var (
_ = flag.Int("port", 80, "port")
_ = flag.String("host", "localhost", "host")
_ = flag.Float64("float", 3.14, "float")
_ = flag.Bool("bool", true, "bool")
_ = pflag.IntP("port", "p", 80, "port")
_ = pflag.StringP("host", "h", "localhost", "host")
_ = pflag.Float64P("float", "f", 3.14, "float")
_ = pflag.BoolP("bool", "b", true, "bool")
io = opts.Int("port", "p", 80, "port")
so = opts.String("host", "h", "localhost", "host")
fo = opts.Float("float", "f", 3.14, "float")
bo = opts.Bool("bool", "b", true, "bool")
set = opts.Set{io, so, fo, bo}
)
func BenchmarkFlag(b *testing.B) {
args := []string{"-port", "8080", "-host", "localhost", "-float", "3.14", "-bool"}
for i := 0; i < b.N; i++ {
flag.CommandLine.Parse(args)
}
}
func BenchmarkPflag(b *testing.B) {
args := []string{"-p", "8080", "-h", "localhost", "-f", "3.14", "-b"}
for i := 0; i < b.N; i++ {
pflag.CommandLine.Parse(args)
}
}
func BenchmarkOpts(b *testing.B) {
args := []string{"-p", "8080", "-h", "localhost", "-f", "3.14", "-b"}
for i := 0; i < b.N; i++ {
parser := opts.NewParser(args, set, false)
parser.Parse()
}
}