Skip to content

Commit 99522db

Browse files
authored
Merge pull request #11 from alecmocatta/stable
Working on stable
2 parents f8038f5 + 4a7b9db commit 99522db

File tree

11 files changed

+282
-181
lines changed

11 files changed

+282
-181
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*]
2+
tab_width = 4
3+
4+
[.*]
5+
tab_width = 4

.mergify.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ pull_request_rules:
33
conditions:
44
- base=master
55
- status-success=tests
6-
- label!=work-in-progress
6+
- "label!=work in progress"
77
- "#approved-reviews-by>=1"
88
- "#review-requested=0"
99
- "#changes-requested-reviews-by=0"
10-
- "#commented-reviews-by=0"
1110
actions:
1211
merge:
1312
method: merge
@@ -17,11 +16,10 @@ pull_request_rules:
1716
conditions:
1817
- base=master
1918
- status-success=tests
20-
- label!=work-in-progress
19+
- "label!=work in progress"
2120
- author=alecmocatta # https://github.com/Mergifyio/mergify-engine/issues/451
2221
- "#review-requested=0"
2322
- "#changes-requested-reviews-by=0"
24-
- "#commented-reviews-by=0"
2523
actions:
2624
merge:
2725
method: merge
@@ -36,10 +34,10 @@ pull_request_rules:
3634
- "title~=^WIP: .*"
3735
actions:
3836
label:
39-
add: ["work-in-progress"]
37+
add: ["work in progress"]
4038
- name: auto remove wip label
4139
conditions:
4240
- "-title~=^WIP: .*"
4341
actions:
4442
label:
45-
remove: ["work-in-progress"]
43+
remove: ["work in progress"]

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "streaming_algorithms"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
license = "MIT OR Apache-2.0"
55
authors = ["Alec Mocatta <alec@mocatta.net>"]
66
categories = ["data-structures","algorithms","science"]
@@ -10,16 +10,19 @@ SIMD-accelerated implementations of various streaming algorithms, including Coun
1010
"""
1111
repository = "https://github.com/alecmocatta/streaming_algorithms"
1212
homepage = "https://github.com/alecmocatta/streaming_algorithms"
13-
documentation = "https://docs.rs/streaming_algorithms/0.2.0"
13+
documentation = "https://docs.rs/streaming_algorithms"
1414
readme = "README.md"
1515
edition = "2018"
1616

1717
[badges]
1818
azure-devops = { project = "alecmocatta/streaming_algorithms", pipeline = "tests", build = "16" }
1919
maintenance = { status = "actively-developed" }
2020

21+
[features]
22+
nightly = ["packed_simd"]
23+
2124
[dependencies]
2225
twox-hash = "1.1"
2326
serde = { version = "1.0", features = ["derive"] }
2427
rand = { version = "0.7", features = ["small_rng"] }
25-
packed_simd = { version = "0.3", features = ["into_bits"] }
28+
packed_simd = { version = "0.3", features = ["into_bits"], optional = true }

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![MIT / Apache 2.0 licensed](https://img.shields.io/crates/l/streaming_algorithms.svg?maxAge=2592000)](#License)
55
[![Build Status](https://dev.azure.com/alecmocatta/streaming_algorithms/_apis/build/status/tests?branchName=master)](https://dev.azure.com/alecmocatta/streaming_algorithms/_build?definitionId=16)
66

7-
[📖 Docs](https://docs.rs/streaming_algorithms/0.2.0/streaming_algorithms/) | [💬 Chat](https://constellation.zulipchat.com/#narrow/stream/213236-subprojects)
7+
[📖 Docs](https://docs.rs/streaming_algorithms) | [💬 Chat](https://constellation.zulipchat.com/#narrow/stream/213236-subprojects)
88

99
SIMD-accelerated implementations of various [streaming algorithms](https://en.wikipedia.org/wiki/Streaming_algorithm).
1010

@@ -17,10 +17,10 @@ This library is a work in progress. PRs are very welcome! Currently implemented
1717

1818
A goal of this library is to enable composition of these algorithms; for example Top k + HyperLogLog to enable an approximate version of something akin to `SELECT key FROM table GROUP BY key ORDER BY COUNT(DISTINCT value) DESC LIMIT k`.
1919

20-
Run your application with `RUSTFLAGS="-C target-cpu=native"` to benefit from the SIMD-acceleration like so:
20+
Run your application with `RUSTFLAGS="-C target-cpu=native"` and the `nightly` feature to benefit from the SIMD-acceleration like so:
2121

2222
```bash
23-
RUSTFLAGS="-C target-cpu=native" cargo run --release
23+
RUSTFLAGS="-C target-cpu=native" cargo run --features "streaming_algorithms/nightly" --release
2424
```
2525

2626
See [this gist](https://gist.github.com/debasishg/8172796) for a good list of further algorithms to be implemented. Other resources are [Probabilistic data structures – Wikipedia](https://en.wikipedia.org/wiki/Category:Probabilistic_data_structures), [DataSketches – A similar Java library originating at Yahoo](https://datasketches.github.io/), and [Algebird – A similar Java library originating at Twitter](https://github.com/twitter/algebird).

azure-pipelines.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
trigger: ["master"]
22
pr: ["master"]
3+
schedules:
4+
- cron: "0 1 * * 0"
5+
displayName: "Sunday build"
6+
branches:
7+
include: ["master"]
8+
always: true
39

410
resources:
511
repositories:
@@ -13,19 +19,26 @@ jobs:
1319
parameters:
1420
endpoint: alecmocatta
1521
default:
16-
rust_toolchain: nightly-2020-06-10
17-
rust_lint_toolchain: nightly-2020-06-10
22+
rust_toolchain: stable nightly
23+
rust_lint_toolchain: nightly-2020-07-12
1824
rust_flags: ''
1925
rust_features: ''
20-
rust_target_check: ''
21-
rust_target_build: ''
26+
rust_target_check: 'aarch64-unknown-linux-gnu aarch64-unknown-linux-musl'
27+
rust_target_build: 'x86_64-unknown-linux-musl i686-unknown-linux-musl'
2228
rust_target_run: ''
2329
matrix:
2430
windows:
2531
imageName: 'windows-latest'
2632
rust_target_run: 'x86_64-pc-windows-msvc i686-pc-windows-msvc x86_64-pc-windows-gnu'
27-
mac:
33+
mac0:
2834
imageName: 'macos-latest'
35+
rust_target_build: 'x86_64-unknown-linux-musl i686-unknown-linux-musl aarch64-apple-ios'
36+
rust_target_run: 'x86_64-apple-darwin'
37+
mac1:
38+
imageName: 'macos-latest'
39+
rust_toolchain: nightly
40+
rust_features: ';nightly'
41+
rust_target_build: 'x86_64-unknown-linux-musl i686-unknown-linux-musl aarch64-apple-ios'
2942
rust_target_run: 'x86_64-apple-darwin'
3043
linux:
3144
imageName: 'ubuntu-latest'

src/count_min.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23-
use super::f64_to_usize;
24-
use crate::traits::{Intersect, IntersectPlusUnionIsPlus, New, UnionAssign};
2523
use serde::{Deserialize, Serialize};
2624
use std::{
2725
borrow::Borrow, cmp::max, convert::TryFrom, fmt, hash::{Hash, Hasher}, marker::PhantomData, ops
2826
};
2927
use twox_hash::XxHash;
3028

29+
use super::f64_to_usize;
30+
use crate::traits::{Intersect, IntersectPlusUnionIsPlus, New, UnionAssign};
31+
3132
/// An implementation of a [count-min sketch](https://en.wikipedia.org/wiki/Count–min_sketch) data structure with *conservative updating* for increased accuracy.
3233
///
3334
/// This data structure is also known as a [counting Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter#Counting_filters).
@@ -75,7 +76,7 @@ where
7576
where
7677
Q: Hash,
7778
K: Borrow<Q>,
78-
C: for<'a> ops::AddAssign<&'a V>,
79+
C: for<'a> ops::AddAssign<&'a V> + IntersectPlusUnionIsPlus,
7980
{
8081
if !<C as IntersectPlusUnionIsPlus>::VAL {
8182
let offsets = self.offsets(key);

0 commit comments

Comments
 (0)