Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
m
  • Loading branch information
komuw committed Feb 9, 2024
commit 17f36ed38dc22eec57638b5d746594f4c9ea97ae
2 changes: 1 addition & 1 deletion cookie/cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func BenchmarkSetEncrypted(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
r = testSetEncrypted(req, res)
}

Expand Down
2 changes: 1 addition & 1 deletion cry/enc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func BenchmarkEnc(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
encryptedMsg := enc.Encrypt(msgToEncrypt)
decryptedMsg, err := enc.Decrypt(encryptedMsg)
r = decryptedMsg
Expand Down
8 changes: 4 additions & 4 deletions errors/errors_benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func BenchmarkOtherWrappers(b *testing.B) {
var err error
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
err = stdErrors.New("error")
}
globalStd = err
Expand All @@ -32,7 +32,7 @@ func BenchmarkOtherWrappers(b *testing.B) {
var err error
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
err = New("error")
}
globalOng = err
Expand All @@ -42,7 +42,7 @@ func BenchmarkOtherWrappers(b *testing.B) {
var err error
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
err = pkgErrors.New("error")
}
globalPkg = err
Expand All @@ -52,7 +52,7 @@ func BenchmarkOtherWrappers(b *testing.B) {
var err error
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
err = errtrace.New("error")
}
globalTrace = err
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/komuw/ong
go 1.22

require (
golang.org/x/crypto v0.18.0
golang.org/x/net v0.20.0
golang.org/x/sys v0.16.0
golang.org/x/crypto v0.19.0
golang.org/x/net v0.21.0
golang.org/x/sys v0.17.0
)

require (
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
4 changes: 2 additions & 2 deletions internal/acme/acme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func BenchmarkGetCertificate(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
cert, errC := getCrt(&tls.ClientHelloInfo{
ServerName: domain,
})
Expand Down Expand Up @@ -611,7 +611,7 @@ func BenchmarkHandler(b *testing.B) {
b.Run("success", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, challengeURI, nil)
req.Host = domain
Expand Down
2 changes: 1 addition & 1 deletion internal/mx/mx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func BenchmarkMuxNew(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
mux, err := New(
config.WithOpts("localhost", 443, tst.SecretKey(), config.DirectIpStrategy, l),
nil,
Expand Down
36 changes: 18 additions & 18 deletions log/log_benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func BenchmarkBestCase(b *testing.B) {
l := newZapLogger(zap.DebugLevel)
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(str)
}
})
Expand All @@ -125,7 +125,7 @@ func BenchmarkBestCase(b *testing.B) {
l := newLogrus()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(str)
}
})
Expand All @@ -134,7 +134,7 @@ func BenchmarkBestCase(b *testing.B) {
l := newZerolog()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info().Msg(str)
}
})
Expand All @@ -143,7 +143,7 @@ func BenchmarkBestCase(b *testing.B) {
l := newOngLogger()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(sl[0], slAny...)
}
})
Expand All @@ -152,15 +152,15 @@ func BenchmarkBestCase(b *testing.B) {
l := newSlogLogger()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(sl[0], slAny...)
}
})

b.Run("no logger", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
noOpFunc("")
}
})
Expand All @@ -177,7 +177,7 @@ func BenchmarkAverageCase(b *testing.B) {
l := newZapLogger(zap.DebugLevel)
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(str)
if rand.Intn(100) >= 99 {
l.Error(logErr.Error())
Expand All @@ -189,7 +189,7 @@ func BenchmarkAverageCase(b *testing.B) {
l := newLogrus()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(str)
if rand.Intn(100) >= 99 {
l.Error(logErr.Error())
Expand All @@ -201,7 +201,7 @@ func BenchmarkAverageCase(b *testing.B) {
l := newZerolog()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info().Msg(str)
if rand.Intn(100) >= 99 {
l.Error().Msg(logErr.Error())
Expand All @@ -213,7 +213,7 @@ func BenchmarkAverageCase(b *testing.B) {
l := newOngLogger()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(sl[0], slAny...)
if rand.Intn(100) >= 99 {
l.Error("some-error", logErr)
Expand All @@ -225,7 +225,7 @@ func BenchmarkAverageCase(b *testing.B) {
l := newSlogLogger()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(sl[0], slAny...)
if rand.Intn(100) >= 99 {
l.Error("some-error", logErr)
Expand All @@ -236,7 +236,7 @@ func BenchmarkAverageCase(b *testing.B) {
b.Run("no logger", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
noOpFunc("")
}
})
Expand All @@ -253,7 +253,7 @@ func BenchmarkWorstCase(b *testing.B) {
l := newZapLogger(zap.DebugLevel)
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(str)
l.Error(logErr.Error())
}
Expand All @@ -263,7 +263,7 @@ func BenchmarkWorstCase(b *testing.B) {
l := newLogrus()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(str)
l.Error(logErr.Error())
}
Expand All @@ -273,7 +273,7 @@ func BenchmarkWorstCase(b *testing.B) {
l := newZerolog()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info().Msg(str)
l.Error().Msg(logErr.Error())
}
Expand All @@ -283,7 +283,7 @@ func BenchmarkWorstCase(b *testing.B) {
l := newOngLogger()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(sl[0], slAny...)
l.Error("some-error", logErr)
}
Expand All @@ -293,7 +293,7 @@ func BenchmarkWorstCase(b *testing.B) {
l := newSlogLogger()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
l.Info(sl[0], slAny...)
l.Error("some-error", logErr)
}
Expand All @@ -302,7 +302,7 @@ func BenchmarkWorstCase(b *testing.B) {
b.Run("no logger", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
noOpFunc("")
}
})
Expand Down
10 changes: 5 additions & 5 deletions middleware/gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func BenchmarkOngGzip(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/someUri", nil)
req.Header.Add(acceptEncodingHeader, "br;q=1.0, gzip;q=0.8, *;q=0.1")
Expand All @@ -344,7 +344,7 @@ func BenchmarkKlauspostGzip(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/someUri", nil)
req.Header.Add(acceptEncodingHeader, "br;q=1.0, gzip;q=0.8, *;q=0.1")
Expand All @@ -367,7 +367,7 @@ func BenchmarkNytimesGzip(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/someUri", nil)
req.Header.Add(acceptEncodingHeader, "br;q=1.0, gzip;q=0.8, *;q=0.1")
Expand All @@ -390,7 +390,7 @@ func BenchmarkTmthrgdGzip(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/someUri", nil)
req.Header.Add(acceptEncodingHeader, "br;q=1.0, gzip;q=0.8, *;q=0.1")
Expand All @@ -413,7 +413,7 @@ func BenchmarkNoGzip(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/someUri", nil)
req.Header.Add(acceptEncodingHeader, "br;q=1.0, deflate;q=0.8, *;q=0.1")
Expand Down
2 changes: 1 addition & 1 deletion middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func BenchmarkAllMiddlewares(b *testing.B) {

b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
req, err := http.NewRequest(http.MethodGet, ts.URL, nil)
attest.Ok(b, err)
req.Header.Set(acceptEncodingHeader, "br;q=1.0, gzip;q=0.8, *;q=0.1")
Expand Down
2 changes: 1 addition & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func BenchmarkServer(b *testing.B) {
var r int

b.ResetTimer()
for n := 0; n < b.N; n++ {
for range b.N {
// The loop body is executed b.N times total across all goroutines.
res, err := c.Get(url)
attest.Ok(b, err)
Expand Down
Loading