Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eskip: use Predicate instead of matcher #2871

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

AlexanderYastrebov
Copy link
Member

They are equivalent and using predicate reduces unnecessary copying. This is also consistent with parsing filters straight into []*Filter.

goos: linux
goarch: amd64
pkg: github.com/zalando/skipper/eskip
                  │   HEAD~1    │                HEAD                │
                  │   sec/op    │   sec/op     vs base               │
ParsePredicates-8   9.192µ ± 2%   8.788µ ± 3%  -4.40% (p=0.007 n=10)
Parse-8             273.1m ± 2%   260.6m ± 2%  -4.58% (p=0.000 n=10)
geomean             1.585m        1.513m       -4.49%

                  │    HEAD~1    │                HEAD                 │
                  │     B/op     │     B/op      vs base               │
ParsePredicates-8   2.008Ki ± 0%   1.961Ki ± 0%  -2.33% (p=0.000 n=10)
Parse-8             49.94Mi ± 0%   49.02Mi ± 0%  -1.83% (p=0.000 n=10)
geomean             320.4Ki        313.7Ki       -2.08%

                  │   HEAD~1    │                HEAD                │
                  │  allocs/op  │  allocs/op   vs base               │
ParsePredicates-8    33.00 ± 0%    32.00 ± 0%  -3.03% (p=0.000 n=10)
Parse-8             1.100M ± 0%   1.080M ± 0%  -1.82% (p=0.000 n=10)
geomean             6.025k        5.879k       -2.43%

They are equivalent and using predicate reduces unnecessary copying.
This is also consistent with parsing filters straight into `[]*Filter`.

```
goos: linux
goarch: amd64
pkg: github.com/zalando/skipper/eskip
                  │   HEAD~1    │                HEAD                │
                  │   sec/op    │   sec/op     vs base               │
ParsePredicates-8   9.192µ ± 2%   8.788µ ± 3%  -4.40% (p=0.007 n=10)
Parse-8             273.1m ± 2%   260.6m ± 2%  -4.58% (p=0.000 n=10)
geomean             1.585m        1.513m       -4.49%

                  │    HEAD~1    │                HEAD                 │
                  │     B/op     │     B/op      vs base               │
ParsePredicates-8   2.008Ki ± 0%   1.961Ki ± 0%  -2.33% (p=0.000 n=10)
Parse-8             49.94Mi ± 0%   49.02Mi ± 0%  -1.83% (p=0.000 n=10)
geomean             320.4Ki        313.7Ki       -2.08%

                  │   HEAD~1    │                HEAD                │
                  │  allocs/op  │  allocs/op   vs base               │
ParsePredicates-8    33.00 ± 0%    32.00 ± 0%  -3.03% (p=0.000 n=10)
Parse-8             1.100M ± 0%   1.080M ± 0%  -1.82% (p=0.000 n=10)
geomean             6.025k        5.879k       -2.43%
```

Signed-off-by: Alexander Yastrebov <[email protected]>
@AlexanderYastrebov AlexanderYastrebov added the minor no risk changes, for example new filters label Jan 17, 2024
frontend:
matcher {
$$.matchers = []*matcher{$1.matcher}
predicates:
Copy link
Member Author

@AlexanderYastrebov AlexanderYastrebov Jan 17, 2024

Choose a reason for hiding this comment

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

This renames rules consistently and opens a way to parse predicates and filters separately, see draft branch https://github.com/zalando/skipper/tree/eskip/separate-parse-predicates-filters based on this

@szuecs
Copy link
Member

szuecs commented Jan 17, 2024

👍

1 similar comment
@AlexanderYastrebov
Copy link
Member Author

👍

@AlexanderYastrebov AlexanderYastrebov merged commit ce65352 into master Jan 17, 2024
14 checks passed
@AlexanderYastrebov AlexanderYastrebov deleted the eskip/use-predicate-instead-of-matcher branch January 17, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor no risk changes, for example new filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants