Skip to content

Commit

Permalink
cleanup: remove unused function IndexRune
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneWerner87 committed Jan 30, 2025
1 parent d0ed605 commit f5b7a12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 0 additions & 9 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,15 +728,6 @@ func IsMethodIdempotent(m string) bool {
}
}

func IndexRune(str string, needle int32) bool {
for _, b := range str {
if b == needle {
return true
}
}
return false
}

// Convert a string value to a specified type, handling errors and optional default values.
func Convert[T any](value string, convertor func(string) (T, error), defaultValue ...T) (T, error) {
converted, err := convertor(value)
Expand Down
4 changes: 2 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,13 @@ func Benchmark_SlashRecognition(b *testing.B) {
}
require.True(b, result)
})
b.Run("IndexRune", func(b *testing.B) {
b.Run("strings.ContainsRune", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
result = false
c := int32(slashDelimiter)
for i := 0; i < b.N; i++ {
result = IndexRune(search, c)
result = strings.ContainsRune(search, c)
}
require.True(b, result)
})
Expand Down

1 comment on commit f5b7a12

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: f5b7a12 Previous: 42d921d Ratio
Benchmark_Ctx_Send 7.159 ns/op 0 B/op 0 allocs/op 4.364 ns/op 0 B/op 0 allocs/op 1.64
Benchmark_Ctx_Send - ns/op 7.159 ns/op 4.364 ns/op 1.64
Benchmark_Utils_GetOffer/1_parameter 214.6 ns/op 0 B/op 0 allocs/op 134.2 ns/op 0 B/op 0 allocs/op 1.60
Benchmark_Utils_GetOffer/1_parameter - ns/op 214.6 ns/op 134.2 ns/op 1.60
`Benchmark_RoutePatternMatch//api/:param/fixedEnd_ not_match _/api/abc/def/fixedEnd - allocs/op` 14 allocs/op
Benchmark_Middleware_BasicAuth - B/op 80 B/op 48 B/op 1.67
Benchmark_Middleware_BasicAuth - allocs/op 5 allocs/op 3 allocs/op 1.67
Benchmark_Middleware_BasicAuth_Upper - B/op 80 B/op 48 B/op 1.67
Benchmark_Middleware_BasicAuth_Upper - allocs/op 5 allocs/op 3 allocs/op 1.67
Benchmark_CORS_NewHandler - B/op 16 B/op 0 B/op +∞
Benchmark_CORS_NewHandler - allocs/op 1 allocs/op 0 allocs/op +∞
Benchmark_CORS_NewHandlerSingleOrigin - B/op 16 B/op 0 B/op +∞
Benchmark_CORS_NewHandlerSingleOrigin - allocs/op 1 allocs/op 0 allocs/op +∞
Benchmark_CORS_NewHandlerPreflight - B/op 104 B/op 0 B/op +∞
Benchmark_CORS_NewHandlerPreflight - allocs/op 5 allocs/op 0 allocs/op +∞
Benchmark_CORS_NewHandlerPreflightSingleOrigin - B/op 104 B/op 0 B/op +∞
Benchmark_CORS_NewHandlerPreflightSingleOrigin - allocs/op 5 allocs/op 0 allocs/op +∞
Benchmark_CORS_NewHandlerPreflightWildcard - B/op 104 B/op 0 B/op +∞
Benchmark_CORS_NewHandlerPreflightWildcard - allocs/op 5 allocs/op 0 allocs/op +∞
Benchmark_Middleware_CSRF_GenerateToken - B/op 520 B/op 322 B/op 1.61
Benchmark_Middleware_CSRF_GenerateToken - allocs/op 10 allocs/op 6 allocs/op 1.67

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.