diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 68c4804..1dd7892 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,13 +13,12 @@ env: jobs: test: - name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }} with bindgen features '${{ matrix.cargo_features }}' + name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }}' runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - rust: [stable, nightly] - cargo_features: [''] + os: [windows-latest] + rust: [nightly] steps: - uses: hecrj/setup-rust-action@v2 @@ -39,38 +38,39 @@ jobs: run: echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV shell: bash - - name: Cargo fmt - run: cargo +${{ matrix.rust }} fmt --all -- --check - if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' - - - name: Cargo clippy - run: cargo +${{ matrix.rust }} clippy --all-targets --workspace --features "${{ matrix.cargo_features }}" - if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features != '' + - name: Run c roaring + if: matrix.os == 'windows-latest' + run: | + clang --version || true + clang -O3 -o c_roaring.exe roaring_fast_or.c + ./c_roaring.exe + + gcc --version || true + gcc -O3 -o c_roaring.exe roaring_fast_or.c + ./c_roaring.exe + + gcc --version || true + shell: bash - - name: Cargo clippy - run: cargo +${{ matrix.rust }} clippy --all-targets --workspace - if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features == '' - - name: Build - run: cargo +${{ matrix.rust }} build --features "${{ matrix.cargo_features }}" - if: matrix.cargo_features != '' + # - name: Cargo fmt + # run: cargo +${{ matrix.rust }} fmt --all -- --check + # if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' - - name: Build - run: cargo +${{ matrix.rust }} build - if: matrix.cargo_features == '' + # - name: Cargo clippy + # run: cargo +${{ matrix.rust }} clippy --all-targets --workspace + # if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' - - name: Test - run: cargo +${{ matrix.rust }} test --features "${{ matrix.cargo_features }}" - if: matrix.cargo_features != '' + # - name: Build + # run: cargo +${{ matrix.rust }} build - - name: Test - run: cargo +${{ matrix.rust }} test - if: matrix.cargo_features == '' + # - name: Test + # run: cargo +${{ matrix.rust }} test - name: Benchmark if: matrix.rust == 'nightly' - run: cargo +${{ matrix.rust }} bench + run: cargo +${{ matrix.rust }} bench -- 'or/fast' - - name: Minimal versions - if: matrix.rust == 'nightly' - run: cargo +${{ matrix.rust }} -Zdirect-minimal-versions test + # - name: Minimal versions + # if: matrix.rust == 'nightly' + # run: cargo +${{ matrix.rust }} -Zdirect-minimal-versions test diff --git a/croaring-sys/build.rs b/croaring-sys/build.rs index b76e896..f969845 100644 --- a/croaring-sys/build.rs +++ b/croaring-sys/build.rs @@ -6,6 +6,7 @@ fn main() { println!("cargo:rerun-if-env-changed=ROARING_ARCH"); let mut build = cc::Build::new(); + let compiler = build.get_compiler(); build.file("CRoaring/roaring.c"); if let Ok(target_arch) = env::var("ROARING_ARCH") { @@ -13,5 +14,7 @@ fn main() { } build.flag_if_supported("-Wno-unused-function"); + eprintln!("compiler {:?}", compiler); + eprintln!("build: {build:#?}"); build.compile("roaring"); } diff --git a/croaring/src/bitmap/imp.rs b/croaring/src/bitmap/imp.rs index b946e8e..70685cb 100644 --- a/croaring/src/bitmap/imp.rs +++ b/croaring/src/bitmap/imp.rs @@ -491,6 +491,15 @@ impl Bitmap { #[doc(alias = "roaring_bitmap_or_many")] #[must_use] pub fn fast_or(bitmaps: &[&Bitmap]) -> Self { + #[cfg(windows)] + { + extern "C" { + pub fn croaring_hardware_support() -> std::ffi::c_int; + } + eprintln!("hardware support: {:x}", unsafe { + croaring_hardware_support() + }); + } let mut bms: Vec<*const ffi::roaring_bitmap_s> = bitmaps .iter() .map(|item| ptr::addr_of!(item.bitmap)) diff --git a/roaring_fast_or.c b/roaring_fast_or.c new file mode 100644 index 0000000..061d051 --- /dev/null +++ b/roaring_fast_or.c @@ -0,0 +1,17 @@ +#include "croaring-sys/CRoaring/roaring.c" + +int main(void) { + roaring_bitmap_t *r1 = roaring_bitmap_of(2, 500, 1000); + roaring_bitmap_t *r2 = roaring_bitmap_of(2, 1000, 2000); + + const roaring_bitmap_t *bitmap_arr[2] = {r1, r2}; + for (int i = 0; i < 10000; i++) { + roaring_bitmap_t *r = roaring_bitmap_or_many(2, bitmap_arr); + roaring_bitmap_free(r); + } + + printf("Got done\n"); + + roaring_bitmap_free(r2); + roaring_bitmap_free(r1); +} \ No newline at end of file