Fix running cargo bench & test in CI. (#14943)

This commit is contained in:
Patrick Cloke 2023-01-31 08:00:07 -05:00 committed by GitHub
parent 3b8574b4f2
commit 585180594b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 0 deletions

View file

@ -13,6 +13,7 @@
// limitations under the License.
#![feature(test)]
use std::collections::BTreeSet;
use synapse::push::{
evaluator::PushRuleEvaluator, Condition, EventMatchCondition, FilteredPushRules, PushRules,
};
@ -32,6 +33,8 @@ fn bench_match_exact(b: &mut Bencher) {
let eval = PushRuleEvaluator::py_new(
flattened_keys,
BTreeSet::new(),
false,
10,
Some(0),
Default::default(),
@ -68,6 +71,8 @@ fn bench_match_word(b: &mut Bencher) {
let eval = PushRuleEvaluator::py_new(
flattened_keys,
BTreeSet::new(),
false,
10,
Some(0),
Default::default(),
@ -104,6 +109,8 @@ fn bench_match_word_miss(b: &mut Bencher) {
let eval = PushRuleEvaluator::py_new(
flattened_keys,
BTreeSet::new(),
false,
10,
Some(0),
Default::default(),
@ -140,6 +147,8 @@ fn bench_eval_message(b: &mut Bencher) {
let eval = PushRuleEvaluator::py_new(
flattened_keys,
BTreeSet::new(),
false,
10,
Some(0),
Default::default(),
@ -156,6 +165,7 @@ fn bench_eval_message(b: &mut Bencher) {
false,
false,
false,
false,
);
b.iter(|| eval.run(&rules, Some("bob"), Some("person")));