chore: sync project state and current artifacts
This commit is contained in:
@@ -4,26 +4,23 @@
|
||||
//! Cached path should show significant speedup when the backend is expensive (e.g. CoolProp).
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use entropyk_fluids::{
|
||||
CachedBackend, FluidBackend, FluidId, Property, ThermoState, TestBackend,
|
||||
};
|
||||
use entropyk_core::{Pressure, Temperature};
|
||||
use entropyk_fluids::{CachedBackend, FluidBackend, FluidId, Property, TestBackend, ThermoState};
|
||||
|
||||
const N_QUERIES: u32 = 10_000;
|
||||
|
||||
fn bench_uncached_10k(c: &mut Criterion) {
|
||||
let backend = TestBackend::new();
|
||||
let state = ThermoState::from_pt(
|
||||
Pressure::from_bar(1.0),
|
||||
Temperature::from_celsius(25.0),
|
||||
);
|
||||
let state = ThermoState::from_pt(Pressure::from_bar(1.0), Temperature::from_celsius(25.0));
|
||||
let fluid = FluidId::new("R134a");
|
||||
|
||||
c.bench_function("uncached_10k_same_state", |b| {
|
||||
b.iter(|| {
|
||||
for _ in 0..N_QUERIES {
|
||||
black_box(
|
||||
backend.property(fluid.clone(), Property::Density, state.clone()).unwrap(),
|
||||
backend
|
||||
.property(fluid.clone(), Property::Density, state.clone())
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -33,17 +30,16 @@ fn bench_uncached_10k(c: &mut Criterion) {
|
||||
fn bench_cached_10k(c: &mut Criterion) {
|
||||
let inner = TestBackend::new();
|
||||
let cached = CachedBackend::new(inner);
|
||||
let state = ThermoState::from_pt(
|
||||
Pressure::from_bar(1.0),
|
||||
Temperature::from_celsius(25.0),
|
||||
);
|
||||
let state = ThermoState::from_pt(Pressure::from_bar(1.0), Temperature::from_celsius(25.0));
|
||||
let fluid = FluidId::new("R134a");
|
||||
|
||||
c.bench_function("cached_10k_same_state", |b| {
|
||||
b.iter(|| {
|
||||
for _ in 0..N_QUERIES {
|
||||
black_box(
|
||||
cached.property(fluid.clone(), Property::Density, state.clone()).unwrap(),
|
||||
cached
|
||||
.property(fluid.clone(), Property::Density, state.clone())
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user