Skip to content

Commit 158703d

Browse files
amatgilkaikalii
authored andcommitted
Tweak tests, use ahasher
1 parent f386dae commit 158703d

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ wasm-bindgen = {workspace = true, optional = true}
182182
web-sys = {version = "0.3.60", optional = true}
183183

184184
# Window dependencies
185+
ahash = "0.8.12"
185186
eframe = {version = "0.33.0", optional = true, features = ["persistence"]}
186187
native-dialog = {version = "0.7.0", optional = true}
187188
rand_xoshiro = "0.7.0"

src/algorithm/dyadic/mod.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,44 @@ use core::f64;
88
use std::{
99
borrow::Cow,
1010
cmp::Ordering,
11-
hash::{DefaultHasher, Hash, Hasher},
11+
hash::{Hash, Hasher},
1212
iter::{once, repeat_n},
1313
mem::{replace, swap, take},
1414
};
1515

16+
use ahash::AHasher;
1617
use bytemuck::allocation::cast_vec;
17-
use ecow::{eco_vec, EcoVec};
18+
use ecow::{EcoVec, eco_vec};
1819
use rand_xoshiro::{
19-
rand_core::{RngCore, SeedableRng},
2020
Xoshiro256Plus,
21+
rand_core::{RngCore, SeedableRng},
2122
};
2223

2324
#[cfg(not(target_arch = "wasm32"))]
2425
use rayon::prelude::*;
2526
use smallvec::SmallVec;
2627

2728
use crate::{
28-
algorithm::pervade::{self, bin_pervade_recursive, InfalliblePervasiveFn},
29+
Complex, RNG, Shape, Uiua, UiuaResult,
30+
algorithm::pervade::{self, InfalliblePervasiveFn, bin_pervade_recursive},
2931
array::*,
3032
boxed::Boxed,
31-
cowslice::{cowslice, extend_repeat, CowSlice},
33+
cowslice::{CowSlice, cowslice, extend_repeat},
3234
fill::FillValue,
3335
grid_fmt::GridFmt,
3436
val_as_arr,
3537
value::Value,
36-
Complex, Shape, Uiua, UiuaResult, RNG,
3738
};
3839

3940
use super::{
40-
shape_prefixes_match, validate_size, validate_size_of, ArrayCmpSlice, FillContext, SizeError,
41+
ArrayCmpSlice, FillContext, SizeError, shape_prefixes_match, validate_size, validate_size_of,
4142
};
4243

4344
macro_rules! par_if {
4445
($cond:expr, $if_true:expr, $if_false:expr) => {{
4546
#[cfg(not(target_arch = "wasm32"))]
4647
{
47-
if $cond {
48-
$if_true
49-
} else {
50-
$if_false
51-
}
48+
if $cond { $if_true } else { $if_false }
5249
}
5350
#[cfg(target_arch = "wasm32")]
5451
$if_false
@@ -2127,7 +2124,7 @@ impl Value {
21272124
}
21282125
/// Generate randomly seeded arrays
21292126
pub fn seeded_gen(&self, seed: &Self, env: &Uiua) -> UiuaResult<Value> {
2130-
let mut hasher = DefaultHasher::new();
2127+
let mut hasher = AHasher::default();
21312128
seed.hash(&mut hasher);
21322129
let seed = hasher.finish();
21332130
let mut rng = Xoshiro256Plus::seed_from_u64(seed);

src/run_prim.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::{
1818
OnceLock,
1919
atomic::{self, AtomicUsize},
2020
},
21-
time::{SystemTime, UNIX_EPOCH},
2221
};
2322

2423
use rand_xoshiro::{

tests/monadic.ua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,5 +285,6 @@ ReprTest! ←^ ˙$"\"_\" repr _" °□⊢
285285
⍤⤙≍ ⟜⍜binary∘ ×π ⇡256
286286

287287
# Rand/Gen
288-
/×♭×⊃≥₀≤₁ gen1000_1000 0
289-
/×♭×⊃≥₀≤₁⍥₁₀₀₀₀⚂
288+
⍤⤙≍1 /×♭×⊃≥₀≤₁ gen1000_1000 0
289+
⍤⤙≍1 /×♭×⊃≥₀≤₁⍥₁₀₀₀₀⚂
290+
⍤⤙≍ 1000_1000 △gen1000_1000 0

0 commit comments

Comments
 (0)