Skip to content

Commit

Permalink
[perf] Limit hash impl
Browse files Browse the repository at this point in the history
  • Loading branch information
didierofrivia committed Jul 3, 2023
1 parent e230a93 commit 3c1ed26
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions limitador/src/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,24 +406,8 @@ impl Hash for Limit {
fn hash<H: Hasher>(&self, state: &mut H) {
self.namespace.hash(state);
self.seconds.hash(state);

let mut encoded_conditions = self
.conditions
.iter()
.map(|c| c.clone().into())
.collect::<Vec<String>>();

encoded_conditions.sort();
encoded_conditions.hash(state);

let mut encoded_vars = self
.variables
.iter()
.map(|c| c.to_string())
.collect::<Vec<String>>();

encoded_vars.sort();
encoded_vars.hash(state);
self.conditions.iter().for_each(|e| e.hash(state));
self.variables.iter().for_each(|e| e.hash(state));
}
}

Expand Down

0 comments on commit 3c1ed26

Please sign in to comment.