Files
dioxus/packages/generational-box/benches/lock.rs
T
c5b33924ae updated the dependencies - maintaining compatibility and tests (#4363)
* Update dependencies in Cargo.lock

* added in the missing bevy example which was included in recent merge

* undo unneccessary library installation in gh actions

* cleaned up further

* Update dependencies in Cargo.toml and Cargo.lock askana_escape to 0.13

* updated code to make tests work

* updated the wgpu texture example

* replaced all direct reference with use

* fixed wgpu and jsframework errors in benches and examples

* Fix: Import black_box from std::hint

* grand finale upgrade

* updated cargo.lock

* Bump hyper-util to 0.1.15 and plist to 1.7.4

* remove some unused swc dependencies and add a command to update them in the future

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-07-14 13:03:40 -07:00

35 lines
994 B
Rust

#![allow(unused)]
use generational_box::*;
use criterion::{criterion_group, criterion_main, Criterion};
use std::hint::black_box;
fn create<S: Storage<u32>>(owner: &Owner<S>) -> GenerationalBox<u32, S> {
owner.insert(0)
}
fn set_read<S: Storage<u32>>(signal: GenerationalBox<u32, S>) -> u32 {
signal.set(1);
*signal.read()
}
fn bench_fib(c: &mut Criterion) {
{
let owner = UnsyncStorage::owner();
c.bench_function("create_unsync", |b| b.iter(|| create(black_box(&owner))));
let signal = create(&owner);
c.bench_function("set_read_unsync", |b| {
b.iter(|| set_read(black_box(signal)))
});
}
{
let owner = SyncStorage::owner();
c.bench_function("create_sync", |b| b.iter(|| create(black_box(&owner))));
let signal = create(&owner);
c.bench_function("set_read_sync", |b| b.iter(|| set_read(black_box(signal))));
}
}
criterion_group!(benches, bench_fib);
criterion_main!(benches);