-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: improve apply update performance (y-crdt/y-octo#34)
this PR partially solves y-crdt/y-octo##33 and greatly improves the performance of apply update test cases show a performance improvement of about 40-50%
- Loading branch information
1 parent
49a6b7a
commit 7428401
Showing
23 changed files
with
244 additions
and
108 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,35 @@ | ||
mod utils; | ||
|
||
use std::time::Duration; | ||
|
||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; | ||
use path_ext::PathExt; | ||
use utils::Files; | ||
|
||
fn apply(c: &mut Criterion) { | ||
let files = Files::load(); | ||
|
||
let mut group = c.benchmark_group("apply"); | ||
group.measurement_time(Duration::from_secs(15)); | ||
|
||
for file in &files.files { | ||
group.throughput(Throughput::Bytes(file.content.len() as u64)); | ||
group.bench_with_input( | ||
BenchmarkId::new("apply with yrs", file.path.name_str()), | ||
&file.content, | ||
|b, content| { | ||
b.iter(|| { | ||
use yrs::{updates::decoder::Decode, Doc, Transact, Update}; | ||
let update = Update::decode_v1(content).unwrap(); | ||
let doc = Doc::new(); | ||
doc.transact_mut().apply_update(update); | ||
}); | ||
}, | ||
); | ||
} | ||
|
||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, apply); | ||
criterion_main!(benches); |
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,34 @@ | ||
mod utils; | ||
|
||
use std::time::Duration; | ||
|
||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; | ||
use path_ext::PathExt; | ||
use utils::Files; | ||
|
||
fn apply(c: &mut Criterion) { | ||
let files = Files::load(); | ||
|
||
let mut group = c.benchmark_group("apply"); | ||
group.measurement_time(Duration::from_secs(15)); | ||
|
||
for file in &files.files { | ||
group.throughput(Throughput::Bytes(file.content.len() as u64)); | ||
group.bench_with_input( | ||
BenchmarkId::new("apply with jwst", file.path.name_str()), | ||
&file.content, | ||
|b, content| { | ||
b.iter(|| { | ||
use y_octo::*; | ||
let mut doc = Doc::new(); | ||
doc.apply_update_from_binary(content.clone()).unwrap() | ||
}); | ||
}, | ||
); | ||
} | ||
|
||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, apply); | ||
criterion_main!(benches); |
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
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ mod state; | |
pub use range::*; | ||
pub use somr::*; | ||
pub use state::*; | ||
|
||
use super::*; |
Oops, something went wrong.