mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 00:28:33 +00:00
#### PR Dependency Tree * **PR #14243** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Batch management API for coordinated document mutations and change tracking. * New document accessors (IDs, state snapshots, change/delete set queries) and subscriber count. * **Chores** * Upgraded Rust edition across packages to 2024. * Repository-wide formatting, stylistic cleanups and test adjustments. * **Breaking Changes** * Removed the Node native bindings package and its JS/TS declarations and tests (no longer published/available). <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
36 lines
911 B
Rust
36 lines
911 B
Rust
mod utils;
|
|
|
|
use std::time::Duration;
|
|
|
|
use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
|
|
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::{Doc, Transact, Update, updates::decoder::Decode};
|
|
let update = Update::decode_v1(content).unwrap();
|
|
let doc = Doc::new();
|
|
doc.transact_mut().apply_update(update).unwrap();
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, apply);
|
|
criterion_main!(benches);
|