From eb1efaf694337384ac96c4d79ee9bdf92ea05753 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 17 Oct 2025 11:59:14 -0700 Subject: [PATCH] rename to spacedog, remove unneccessary atomics --- Cargo.toml | 5 ++--- benches/benchmarks.rs | 22 +++++++++------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e539d35..6935f49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,13 @@ [package] -name = "spacebench" +name = "spacedog" version = "0.1.0" edition = "2024" -[dependencies] +[dev-dependencies] clap = "4.5.49" criterion = "0.7.0" rand = "0.9.2" rand_hc = "0.4.0" -rstar = "0.12.2" [[bench]] name = "benchmarks" diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index 2c844a4..db42a47 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -11,15 +11,15 @@ struct Point2d { y: f64, } -#[derive(Debug, Default)] +#[derive(Debug, Default, Clone, Copy)] struct PVal { point: usize, - val: AtomicU64, + val: f64, } impl PartialEq for PVal { fn eq(&self, other: &Self) -> bool { - self.val.load(Relaxed) == other.val.load(Relaxed) + self.val == other.val } } @@ -27,15 +27,13 @@ impl Eq for PVal {} impl PartialOrd for PVal { fn partial_cmp(&self, other: &Self) -> Option { - let a = f64::from_bits(self.val.load(Relaxed)); - let b = f64::from_bits(other.val.load(Relaxed)); - a.partial_cmp(&b) + Some(self.cmp(other)) } } impl Ord for PVal { fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.partial_cmp(other).unwrap() + self.val.partial_cmp(&other.val).unwrap() } } @@ -55,12 +53,12 @@ impl Spindex2d { for (i, point) in points.iter().enumerate() { let x = PVal { point: i, - val: AtomicU64::new(point.x.to_bits()), + val: point.x, }; xs.push(x); let y = PVal { point: i, - val: AtomicU64::new(point.y.to_bits()), + val: point.y, }; ys.push(y); @@ -89,17 +87,15 @@ impl Spindex2d { for (i, point) in points.iter().enumerate() { let xi = self.xpoints[i].load(Relaxed); let yi = self.ypoints[i].load(Relaxed); - let x = point.x.to_bits(); let x = PVal { point: i, - val: x.into(), + val: point.x, }; xs[xi] = x; - let y = point.y.to_bits(); let y = PVal { point: i, - val: y.into(), + val: point.y, }; ys[yi] = y; }