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

feat: implement simplify tokens #30

Merged
merged 8 commits into from
Feb 1, 2023
Merged

Conversation

gastonfournier
Copy link
Contributor

@gastonfournier gastonfournier commented Feb 1, 2023

About the changes

This introduces a simplify function that reduces a set of tokens to a minimum set that still pulls the same configuration from the server

Benchmarks

Running benches/benchmark.rs (target/release/deps/benchmark-d1d3ad66b6852229)
simplify_bench          time:   [1.0222 µs 1.0542 µs 1.0856 µs]

@gastonfournier gastonfournier self-assigned this Feb 1, 2023
Comment on lines +57 to +59
&& (self.projects.contains(&"*".into())
|| (self.projects.len() >= other.projects.len()
&& other.projects.iter().all(|p| self.projects.contains(p))));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hate doing 2 iterations on projects, especially because the length check was supposed to prevent going through the list in some situations

server/src/tokens.rs Outdated Show resolved Hide resolved
server/src/tokens.rs Outdated Show resolved Hide resolved
Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

LGTM

@gastonfournier gastonfournier merged commit eab0878 into main Feb 1, 2023
@gastonfournier gastonfournier deleted the implement-simplify-tokens branch February 1, 2023 14:04
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.

2 participants