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

Probe directory tree for wildcard matching #3472

Merged
merged 1 commit into from
Aug 23, 2023
Merged

Probe directory tree for wildcard matching #3472

merged 1 commit into from
Aug 23, 2023

Conversation

KyleJu
Copy link
Collaborator

@KyleJu KyleJu commented Aug 23, 2023

Fix web-platform-tests/wpt-metadata#4665 and a part of #3448. Probe directory tree for wildcard matching, regardless if a match has found.

It should not have much performance impact before and after the change.

@KyleJu KyleJu requested a review from jcscottiii August 23, 2023 01:01
Copy link
Collaborator

@jcscottiii jcscottiii left a comment

Choose a reason for hiding this comment

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

The code LGTM. Could you monitor the performance of this? Now we are always walking up to the root (which is needed for this implementation). If it is bad, we may need a way to improve this look up

@KyleJu
Copy link
Collaborator Author

KyleJu commented Aug 23, 2023

The code LGTM. Could you monitor the performance of this? Now we are always walking up to the root (which is needed for this implementation). If it is bad, we may need a way to improve this look up

Yup that is a good call. The reason for my "It should not have much performance impact before and after the change." is because the algorithm before this change always walks up the root, as most tests don't have a label. In terms of optimization, we could pre-build a tree-like structure against wpt-metadata, traverse the tree from the root directory and accumulate all the labels as it walks down. So it is a constant lookup. E.g.

	metadata := map[string][]string{
		"/foo/bar/b.html": {"random"},
		"/a/*":  {"interop1", "INTEROP2"},
		"/d/e/f":          {""},
		"/a/b/c.html:  {"foo"},
		"/a/b/d.html:  {"bar"},
	}

will result in (remove the wildcards along the way

	metadataTree := map[string][]string{
		"/foo/bar/b.html": {"random"},
		"/d/e/f":          {""},
		"/a/b/c.html":  {"foo", "interop1", "INTEROP2"},
		"/a/b/d.html::  {"bar", "interop1", "INTEROP2"},
	}

@KyleJu KyleJu merged commit 9f00b3c into main Aug 23, 2023
@KyleJu KyleJu deleted the fix-dir-probe branch August 23, 2023 16:57
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.

Directory labels are ignored when a file-specific label is applied
2 participants