update dependencies

This commit is contained in:
Magnus Ulimoen 2019-11-07 20:36:03 +01:00
parent bb5d7b1e38
commit 6058eae076
3 changed files with 25 additions and 15 deletions

View File

@ -11,17 +11,18 @@ crate-type = ["cdylib", "rlib"]
default = ["console_error_panic_hook", "wee_alloc"]
[dependencies]
wasm-bindgen = "*"
console_error_panic_hook = { version = "*", optional = true }
wee_alloc = { version = "*", optional = true }
ndarray = "0.12.1"
wasm-bindgen = "0.2.54"
console_error_panic_hook = { version = "0.1.6", optional = true }
wee_alloc = { version = "0.4.5", optional = true }
ndarray = { version = "0.13.0", features = ["approx"] }
approx = "0.3.2"
[profile.release]
opt-level = 3
lto = "thin"
[dev-dependencies]
criterion = "0.3"
criterion = "0.3.0"
[[bench]]
name = "system"

View File

@ -1,19 +1,28 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use maxwell::Universe;
fn simple_system(w: u32, h: u32) -> Universe {
let mut universe = Universe::new(w, h);
universe.init(0.0, 0.0);
for _ in 0..100 {
fn advance_system(universe: &mut Universe, n: usize) {
for _ in 0..n {
universe.advance(0.01);
}
universe
}
fn performance_benchmark(c: &mut Criterion) {
c.bench_function("complete system", |b| {
b.iter(|| simple_system(black_box(25), black_box(30)))
let mut group = c.benchmark_group("System");
group.sample_size(15);
let w = 35;
let h = 26;
let mut universe = Universe::new(w, h);
group.bench_function("advance", |b| {
b.iter(|| {
universe.init(0.0, 0.0);
advance_system(&mut universe, black_box(20))
})
});
group.finish();
}
criterion_group!(benches, performance_benchmark);

View File

@ -96,7 +96,7 @@ fn upwind4_test() {
}
res.fill(0.0);
Upwind4::diff(source.view(), res.view_mut());
assert!(res.all_close(&target, 1e-4));
approx::assert_abs_diff_eq!(&res, &target, epsilon = 1e-4);
for i in 0..nx {
let x = i as f32 * dx;
@ -105,7 +105,7 @@ fn upwind4_test() {
}
res.fill(0.0);
Upwind4::diff(source.view(), res.view_mut());
assert!(res.all_close(&target, 1e-4));
approx::assert_abs_diff_eq!(&res, &target, epsilon = 1e-4);
for i in 0..nx {
let x = i as f32 * dx;
@ -114,7 +114,7 @@ fn upwind4_test() {
}
res.fill(0.0);
Upwind4::diff(source.view(), res.view_mut());
assert!(res.all_close(&target, 1e-2));
approx::assert_abs_diff_eq!(&res, &target, epsilon = 1e-2);
}
impl SbpOperator for Upwind4 {