Working 'fast' radix

This commit is contained in:
2026-10-02 21:38:59 +02:00
parent 9af63cf2bd
commit efd07fd53b
7 changed files with 71 additions and 23 deletions
+22 -2
View File
@@ -198,7 +198,11 @@ impl State
let mut encoder = device.create_command_encoder(&Default::default());
println!("Making elements");
let elt_count = (1 << 20) as u32;
//let elt_count = (1 << 20) as u32;
//let elt_count = 100_000;
//let elt_count = (21 * 4096) as u32;
//let elt_count = 3000 as u32;
let elt_count = 1_000_000;
//let elt_count = 256 as u32;
let org_big_value_buffer = (0..(elt_count as u32)).collect::<Vec<_>>();
let org_big_key_buffer = org_big_value_buffer
@@ -207,6 +211,22 @@ impl State
.map(|_| random_range(1..256))
.collect::<Vec<_>>();
// let mut prefix = org_big_key_buffer.iter().fold([0; 256], |acc, x| {
// let mut acc = acc;
// acc[x >> 24] += 1;
// acc
// });
//
// let mut sum = 0;
// for x in prefix.iter_mut()
// {
// let cur = *x;
// *x = sum;
// sum += cur;
// }
//
// println!("Counts : {:?}", prefix);
let sorted_values = org_big_key_buffer
.iter()
.zip(org_big_value_buffer.iter())
@@ -267,7 +287,7 @@ impl State
.chunks(4)
.map(|x| u32::from_ne_bytes([x[0], x[1], x[2], x[3]]))
.collect::<Vec<u32>>();
println!("{:?}", &data[0..256]);
println!("{:?}", &data[0..3000]);
},
);