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

Fanout plugin: Improve except option #17

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

denis-tingaikin
Copy link
Member

Signed-off-by: denis-tingajkin denis.tingajkin@xored.com

Description

Currently except option has O(n*m) (where n is the number of exclude domain names and m is the number of parts of the domain name) time to checking request domain name. The current solution is not ideal for the real world and it should be improved to make it work fast for cases with more than 10 000 entries.

Motivation

#12

@snakwu
Copy link

snakwu commented Apr 7, 2020

Very cool!!!

Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com>
require.Nil(t, d.Get(".").Get("com").Get("example").Get("advanced"))
}

func BenchmarkDomain_ContainsMatch(b *testing.B) {
Copy link
Member Author

@denis-tingaikin denis-tingaikin Apr 8, 2020

Choose a reason for hiding this comment

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

This test prints ~20 ms for 10 000 entries.
And the test prints ~103 s for the previous realization.

NOTE: Max segment count of the domain in the test is 100.
The current complexity of this solution is O(n) where n is the number of segments. This means it should work faster in the real world than in these bench tests.

@denis-tingaikin denis-tingaikin marked this pull request as ready for review April 8, 2020 05:07
@snakwu
Copy link

snakwu commented Apr 8, 2020

Signed-off-by: denis-tingajkin denis.tingajkin@xored.com

Description

Currently except option has O(n*m) (where n is the number of exclude domain names and m is the number of parts of the domain name) time to checking request domain name. The current solution is not ideal for the real world and it should be improved to make it work fast for cases with more than 10 000 entries.

Motivation

#12

为什么等了这么信还没合并呢?太期待这功能了!

@haiodo haiodo merged commit 89e1e9d into networkservicemesh:master Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants