Skip to content

Commit

Permalink
make miri tests fast again (take 2) (#884)
Browse files Browse the repository at this point in the history
FSST array tests take ~7.5 minutes on recent develop builds (e.g.,
https://github.com/spiraldb/vortex/actions/runs/10948157580/job/30398557105)

This gets it down to <90s on my laptop

redo of #883
  • Loading branch information
lwwmanning authored Sep 19, 2024
1 parent a96ff2c commit 4168d21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions encodings/fsst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ rust-version = { workspace = true }
[lints]
workspace = true

[dev-dependencies]
rstest = { workspace = true }

[dependencies]
arrow-array = { workspace = true }
fsst-rs = { workspace = true }
Expand Down
28 changes: 10 additions & 18 deletions encodings/fsst/tests/fsst_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(test)]

use rstest::{fixture, rstest};
use vortex::array::builder::VarBinBuilder;
use vortex::array::{BoolArray, PrimitiveArray};
use vortex::compute::unary::scalar_at;
Expand All @@ -16,8 +15,8 @@ macro_rules! assert_nth_scalar {
};
}

#[fixture]
fn fsst_array() -> Array {
// this function is VERY slow on miri, so we only want to run it once
fn build_fsst_array() -> Array {
let mut input_array = VarBinBuilder::<i32>::with_capacity(3);
input_array.push_value(b"The Greeks never said that the limit could not he overstepped");
input_array.push_value(
Expand All @@ -35,8 +34,10 @@ fn fsst_array() -> Array {
.into_array()
}

#[rstest]
fn test_scalar_at(fsst_array: Array) {
#[test]
fn test_fsst_array_ops() {
// first test the scalar_at values
let fsst_array = build_fsst_array();
assert_nth_scalar!(
fsst_array,
0,
Expand All @@ -52,10 +53,8 @@ fn test_scalar_at(fsst_array: Array) {
2,
"Nothing in present history can contradict them"
);
}

#[rstest]
fn test_slice(fsst_array: Array) {
// test slice
let fsst_sliced = slice(&fsst_array, 1, 3).unwrap();
assert_eq!(fsst_sliced.encoding().id(), FSST::ENCODING.id());
assert_eq!(fsst_sliced.len(), 2);
Expand All @@ -69,10 +68,8 @@ fn test_slice(fsst_array: Array) {
1,
"Nothing in present history can contradict them"
);
}

#[rstest]
fn test_take(fsst_array: Array) {
// test take
let indices = PrimitiveArray::from_vec(vec![0, 2], Validity::NonNullable).into_array();
let fsst_taken = take(&fsst_array, &indices).unwrap();
assert_eq!(fsst_taken.len(), 2);
Expand All @@ -86,10 +83,8 @@ fn test_take(fsst_array: Array) {
1,
"Nothing in present history can contradict them"
);
}

#[rstest]
fn test_filter(fsst_array: Array) {
// test filter
let predicate =
BoolArray::from_vec(vec![false, true, false], Validity::NonNullable).into_array();

Expand All @@ -101,11 +96,8 @@ fn test_filter(fsst_array: Array) {
0,
"They said it existed and that whoever dared to exceed it was mercilessly struck down"
);
}

// Test canonicalizing
#[rstest]
fn test_into_canonical(fsst_array: Array) {
// test into_canonical
let canonical_array = fsst_array
.clone()
.into_canonical()
Expand Down

0 comments on commit 4168d21

Please sign in to comment.