try radsort
bendn 2024-12-01
parent e9a2023 · commit 20dcfa0
-rw-r--r--Cargo.lock7
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs4
3 files changed, 10 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ad4fb6a..ff8ba23 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -38,6 +38,7 @@ dependencies = [
"aoc-runner",
"aoc-runner-derive",
"memchr",
+ "radsort",
"rustc-hash",
]
@@ -90,6 +91,12 @@ dependencies = [
]
[[package]]
+name = "radsort"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "019b4b213425016d7d84a153c4c73afb0946fbb4840e4eece7ba8848b9d6da22"
+
+[[package]]
name = "rustc-hash"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 2640885..ef7a7b1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,4 +7,5 @@ edition = "2021"
aoc-runner = "0.1.0"
aoc-runner-derive = "0.1.0"
memchr = "2.7.4"
+radsort = "0.1.1"
rustc-hash = "2.1.0"
diff --git a/src/lib.rs b/src/lib.rs
index 8ad862b..f062594 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,8 +42,8 @@ pub mod day1 {
*b.get_unchecked_mut(i) = y;
});
- a.sort_unstable();
- b.sort_unstable();
+ radsort::sort(&mut a);
+ radsort::sort(&mut b);
a.iter()
.copied()
.zip(b)