Skip to content

Commit

Permalink
filters/builtin: redo benchmarking and record results
Browse files Browse the repository at this point in the history
pkg: github.com/zalando/skipper/filters/builtin
           │   HEAD~1    │                HEAD                │
           │   sec/op    │   sec/op     vs base               │
Sanitize-8   802.1n ± 0%   748.3n ± 0%  -6.71% (p=0.000 n=10)

           │   HEAD~1   │                HEAD                │
           │    B/op    │    B/op     vs base                │
Sanitize-8   472.0 ± 0%   192.0 ± 0%  -59.32% (p=0.000 n=10)

           │   HEAD~1   │               HEAD                │
           │ allocs/op  │ allocs/op   vs base               │
Sanitize-8   15.00 ± 0%   14.00 ± 0%  -6.67% (p=0.000 n=10)
  • Loading branch information
trkohler committed Feb 22, 2024
1 parent 9b76930 commit 1bd4760
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions filters/builtin/stripquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package builtin

import (
"bytes"
"fmt"
"net/http"
"strconv"
Expand Down Expand Up @@ -52,14 +51,14 @@ func validHeaderFieldByte(b byte) bool {

// make sure we don't generate invalid headers
func sanitize(input string) string {
var s strings.Builder
toAscii := strconv.QuoteToASCII(input)
var b bytes.Buffer
for _, i := range toAscii {
if validHeaderFieldByte(byte(i)) {
b.WriteRune(i)
s.WriteRune(i)
}
}
return b.String()
return s.String()
}

// Strips the query parameters and optionally preserves them in the X-Query-Param-xyz headers.
Expand Down

0 comments on commit 1bd4760

Please sign in to comment.