-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add some benchmarks * Only run bench.yml with performance tag * Revert "Only run bench.yml with performance tag" This reverts commit e5266be. * Rename CI step
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use maple_core::prelude::*; | ||
|
||
pub fn criterion_benchmark(c: &mut Criterion) { | ||
c.bench_function("reactivity signals run get/set 1000x", |b| { | ||
b.iter(|| { | ||
let state = Signal::new(black_box(0)); | ||
|
||
for _i in 0..1000 { | ||
let value = state.get(); | ||
state.set(*value + 1); | ||
} | ||
}) | ||
}); | ||
|
||
c.bench_function("reactivity run effects 1000x", |b| { | ||
b.iter(|| { | ||
let state = Signal::new(black_box(0)); | ||
create_effect(cloned!((state) => move || { | ||
let _double = *state.get() * 2; | ||
})); | ||
|
||
for _i in 0..1000 { | ||
state.set(*state.get() + 1); | ||
} | ||
}) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
5325c62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: