From 5fa0951aa27cabdcefd0c18a7b9f3a34a7d446a9 Mon Sep 17 00:00:00 2001 From: Jacob McCollum Date: Sat, 23 Dec 2023 12:56:37 -0500 Subject: [PATCH 1/3] Remove thin-segments feature - it is of limited usefulness and the library angers miri --- Cargo.toml | 1 - src/lib.rs | 3 --- 2 files changed, 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eee4053..96f86f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ either = "1.8.1" [features] small-vec = ["smallvec"] -thin-segments = ["thin-vec"] [[bench]] name = "segvec_benchmark" diff --git a/src/lib.rs b/src/lib.rs index 909bba1..6dc6c9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,9 +41,6 @@ mod slice; pub use slice::*; pub mod detail { - #[cfg(feature = "thin-segments")] - pub type Segment = thin_vec::ThinVec; - #[cfg(not(feature = "thin-segments"))] pub type Segment = Vec; #[cfg(feature = "small-vec")] From 3d4655cc7fe86dcbeb093267f86a6f3ca279aee4 Mon Sep 17 00:00:00 2001 From: Jacob McCollum Date: Sat, 23 Dec 2023 12:56:52 -0500 Subject: [PATCH 2/3] Enable some more tests --- src/mem_config.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mem_config.rs b/src/mem_config.rs index 544ea23..b8667d7 100644 --- a/src/mem_config.rs +++ b/src/mem_config.rs @@ -341,22 +341,22 @@ pub fn exponential_segment_and_offset() { } } -// Expensive tests (hopefully) catching off by one errors, need to be explicitly enabled +// Expensive tests (hopefully) catching off by one errors. #[test] -#[ignore] +#[cfg_attr(miri, ignore)] pub fn linear() { type DuT = Linear<64>; // segments let mut sum = 0_usize; - for i in 0..10000000000 { + for i in 0..1000000 { sum += DuT::new().segment_size(i); assert_eq!(DuT::new().capacity(i + 1), sum) } // indices - for i in 1..10000000000 { + for i in 1..1000000 { let (segment, index) = DuT::new().segment_and_offset(i); assert!(index < DuT::new().segment_size(segment)); if index == 0 { @@ -368,19 +368,19 @@ pub fn linear() { } #[test] -#[ignore] +#[cfg_attr(miri, ignore)] pub fn proportional() { type DuT = Proportional<4>; // segments let mut sum = 0_usize; - for i in 0..1000000000 { + for i in 0..1000000 { sum += DuT::new().segment_size(i); assert_eq!(DuT::new().capacity(i + 1), sum) } // indices - for i in 1..10000000000 { + for i in 1..1000000 { let (segment, index) = DuT::new().segment_and_offset(i); assert!(index < DuT::new().segment_size(segment)); if index == 0 { @@ -392,7 +392,7 @@ pub fn proportional() { } #[test] -#[ignore] +#[cfg_attr(miri, ignore)] pub fn exponential() { type DuT = Exponential<4>; @@ -400,11 +400,13 @@ pub fn exponential() { let mut sum = 0_usize; for i in 0..60 { sum += DuT::new().segment_size(i); - assert_eq!(DuT::new().capacity(i + 1), sum) + let mut dut = DuT::new(); + dut.update_capacity(i + 1); + assert_eq!(dut.capacity(i + 1), sum) } // indices - for i in 1..10000000000 { + for i in 1..1000000 { let (segment, index) = DuT::new().segment_and_offset(i); assert!(index < DuT::new().segment_size(segment)); if index == 0 { From e6dc38259ac7a378fa525efaeb770cda5f1a41bc Mon Sep 17 00:00:00 2001 From: Jacob McCollum Date: Sat, 23 Dec 2023 12:57:04 -0500 Subject: [PATCH 3/3] update dependencies --- Cargo.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 96f86f1..4bd663a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,14 +9,13 @@ repository = "https://github.com/mccolljr/segvec/" description = "SegVec data structure for rust. Similar to Vec, but allocates memory in chunks of increasing size" [dev-dependencies] -rand = "0.8.4" +rand = "0.8.5" criterion = { version = "0.5.1", features = ["html_reports"] } [dependencies] -smallvec = { version = "1.10.0", features = ["const_generics", "union"], optional = true } -thin-vec = { version = "0.2.3", optional = true } +smallvec = { version = "1.11.2", features = ["const_generics", "union"], optional = true } num-integer = "0.1.45" -either = "1.8.1" +either = "1.9.0" [features] small-vec = ["smallvec"]