probabilistic_machines 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/Cargo.lock +3 -2
- data/ext/probabilistic_machines_native/core/Cargo.toml +1 -1
- data/ext/probabilistic_machines_native/core/src/topk.rs +12 -5
- data/ext/probabilistic_machines_native/ffi/Cargo.toml +13 -1
- data/lib/probabilistic_machines/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b860b9aeb15b8f6ebdb6786cee404032b10637f4656f278be153268551d6b7e9
|
|
4
|
+
data.tar.gz: 40586b97c8222825a608cbc96867710470fcdf1d12827b0235395e3c30dfebc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14a1850c6dfa15b0f0986fe9acf5bb5d57244710254300cf964027fc266a90823db2b7a1be9897fdd66989ad1203fbc330a0c1d7b38ea209510349457c35ad9d
|
|
7
|
+
data.tar.gz: 9909b1ca8777def59303ef7e67a02a8996a6be92070247f1f2be5423c8c5c91641f8f5409b5e5f51cb39234dc72cd175fd749b979406f8843e0ecf0e20ffa3a2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.3](https://github.com/seuros/probabilistic_machines/compare/probabilistic_machines/v0.1.2...probabilistic_machines/v0.1.3) (2026-11-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* enable the rb-sys compiled fallback so new Rubies can build ([e8a649d](https://github.com/seuros/probabilistic_machines/commit/e8a649d45475c77f0a5d19c5fa1477100da0cc1b))
|
|
9
|
+
|
|
10
|
+
## [0.1.2](https://github.com/seuros/probabilistic_machines/compare/probabilistic_machines/v0.1.1...probabilistic_machines/v0.1.2) (2026-11-01)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* accept any cloneable key in HeavyHitters ([108ed8c](https://github.com/seuros/probabilistic_machines/commit/108ed8c79adeffeef708aa298baa7cc64d55d12b))
|
|
16
|
+
* pass a rubygems OTP through the environment ([7a6cc44](https://github.com/seuros/probabilistic_machines/commit/7a6cc446dc737f44e46c4e41b0a76d1fc9b7f5cc))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* a republished platform gem is skipped, not fatal ([6210171](https://github.com/seuros/probabilistic_machines/commit/6210171a4ae679293d9cc6cfbdd82a9d99611a6e))
|
|
22
|
+
* collect the built gems whatever depth the download puts them at ([b377177](https://github.com/seuros/probabilistic_machines/commit/b377177879e2a922184eb3e5f9965e8f8c806f00))
|
|
23
|
+
* the release tag carries the gem name, and the gate uses the aggregate output ([9b949b4](https://github.com/seuros/probabilistic_machines/commit/9b949b4dc257b4251ff7c8806d6c8efdb05ac26d))
|
|
24
|
+
|
|
3
25
|
## [0.1.1](https://github.com/seuros/probabilistic_machines/compare/probabilistic_machines-v0.1.0...probabilistic_machines/v0.1.1) (2026-11-01)
|
|
4
26
|
|
|
5
27
|
|
data/Cargo.lock
CHANGED
|
@@ -158,15 +158,16 @@ dependencies = [
|
|
|
158
158
|
|
|
159
159
|
[[package]]
|
|
160
160
|
name = "probabilistic-machines"
|
|
161
|
-
version = "0.
|
|
161
|
+
version = "0.3.0"
|
|
162
162
|
|
|
163
163
|
[[package]]
|
|
164
164
|
name = "probabilistic_machines_native"
|
|
165
|
-
version = "0.1.
|
|
165
|
+
version = "0.1.2"
|
|
166
166
|
dependencies = [
|
|
167
167
|
"bytes",
|
|
168
168
|
"magnus",
|
|
169
169
|
"probabilistic-machines",
|
|
170
|
+
"rb-sys",
|
|
170
171
|
]
|
|
171
172
|
|
|
172
173
|
[[package]]
|
|
@@ -28,6 +28,13 @@ pub struct Hitter<T> {
|
|
|
28
28
|
/// insertions scan all `K` counters, which is the trade for needing no heap and
|
|
29
29
|
/// no key ordering: keep `K` in the dozens-to-hundreds range.
|
|
30
30
|
///
|
|
31
|
+
/// A key need only be [`Clone`] and [`Eq`], so owned keys work directly:
|
|
32
|
+
/// `HeavyHitters<String, 64>` tracks layer names without interning them first.
|
|
33
|
+
/// Cloning happens on insert and on [`merge`](Self::merge), never on a lookup,
|
|
34
|
+
/// so a cheap key is worth having but a `String` is not a mistake. Interning to
|
|
35
|
+
/// a `u32` id, or hashing with [`hash64`](crate::hash64) the way the Ruby
|
|
36
|
+
/// binding does, keeps the table [`Copy`] and the scan cache-friendly.
|
|
37
|
+
///
|
|
31
38
|
/// ```
|
|
32
39
|
/// use probabilistic_machines::HeavyHitters;
|
|
33
40
|
///
|
|
@@ -48,7 +55,7 @@ pub struct HeavyHitters<T, const K: usize> {
|
|
|
48
55
|
observed: u64,
|
|
49
56
|
}
|
|
50
57
|
|
|
51
|
-
impl<T:
|
|
58
|
+
impl<T: Clone + Eq, const K: usize> HeavyHitters<T, K> {
|
|
52
59
|
#[must_use]
|
|
53
60
|
pub const fn new() -> Self {
|
|
54
61
|
Self {
|
|
@@ -116,7 +123,7 @@ impl<T: Copy + Eq, const K: usize> HeavyHitters<T, K> {
|
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
125
|
for hitter in other.hitters() {
|
|
119
|
-
self.absorb(hitter.key, hitter.count, hitter.overestimate);
|
|
126
|
+
self.absorb(hitter.key.clone(), hitter.count, hitter.overestimate);
|
|
120
127
|
}
|
|
121
128
|
self.observed = self.observed.saturating_add(other.observed);
|
|
122
129
|
}
|
|
@@ -304,18 +311,18 @@ fn records_are_coherent(records: &[[u8; RECORD_LEN]], observed: u64) -> bool {
|
|
|
304
311
|
})
|
|
305
312
|
}
|
|
306
313
|
|
|
307
|
-
impl<T:
|
|
314
|
+
impl<T: Clone + Eq, const K: usize> Default for HeavyHitters<T, K> {
|
|
308
315
|
fn default() -> Self {
|
|
309
316
|
Self::new()
|
|
310
317
|
}
|
|
311
318
|
}
|
|
312
319
|
|
|
313
320
|
#[cfg(feature = "alloc")]
|
|
314
|
-
impl<T:
|
|
321
|
+
impl<T: Clone + Eq, const K: usize> HeavyHitters<T, K> {
|
|
315
322
|
/// Tracked keys, most frequent first.
|
|
316
323
|
#[must_use]
|
|
317
324
|
pub fn ranked(&self) -> alloc::vec::Vec<Hitter<T>> {
|
|
318
|
-
let mut ranked: alloc::vec::Vec<Hitter<T>> = self.hitters().
|
|
325
|
+
let mut ranked: alloc::vec::Vec<Hitter<T>> = self.hitters().cloned().collect();
|
|
319
326
|
ranked.sort_unstable_by_key(|hitter| core::cmp::Reverse(hitter.count));
|
|
320
327
|
ranked
|
|
321
328
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "probabilistic_machines_native"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
edition.workspace = true
|
|
5
5
|
rust-version.workspace = true
|
|
6
6
|
authors = ["Abdelkader Boudih <oss@seuros.com>"]
|
|
@@ -17,4 +17,16 @@ workspace = true
|
|
|
17
17
|
[dependencies]
|
|
18
18
|
probabilistic-machines = { workspace = true, features = ["std"] }
|
|
19
19
|
magnus = { version = ">= 0.9.3", default-features = false, features = ["bytes", "io"] }
|
|
20
|
+
# Nothing here calls rb-sys directly: this is the compiled fallback that
|
|
21
|
+
# implements the stable API for a Ruby rb-sys has no pre-generated bindings
|
|
22
|
+
# for, such as a preview. magnus asks for "stable-api" without it, and
|
|
23
|
+
# default-features = false drops the default that would have supplied it, so
|
|
24
|
+
# removing this line breaks the build on every future Ruby.
|
|
25
|
+
# Nothing here calls rb-sys directly: this is the compiled fallback that
|
|
26
|
+
# implements the stable API for a Ruby rb-sys ships no pre-generated bindings
|
|
27
|
+
# for, such as a preview. magnus asks for "stable-api" without it, and its
|
|
28
|
+
# default-features = false drops the default that would have supplied it, so
|
|
29
|
+
# dropping this line breaks the build on every Ruby newer than rb-sys.
|
|
30
|
+
rb-sys = { version = ">= 0.9.130", default-features = false, features = ["stable-api-compiled-fallback"] }
|
|
31
|
+
|
|
20
32
|
bytes = "1"
|