fast_bloom_filter 1.0.0 → 2.1.0
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 +75 -0
- data/README.md +138 -48
- data/ext/fast_bloom_filter/fast_bloom_filter.c +733 -216
- data/lib/fast_bloom_filter/version.rb +1 -1
- data/lib/fast_bloom_filter.rb +13 -13
- metadata +12 -12
data/lib/fast_bloom_filter.rb
CHANGED
|
@@ -21,30 +21,30 @@ module FastBloomFilter
|
|
|
21
21
|
items.each { |item| add(item.to_s) }
|
|
22
22
|
self
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
def count_possible_matches(items)
|
|
26
26
|
items.count { |item| include?(item.to_s) }
|
|
27
27
|
end
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
def inspect
|
|
30
30
|
s = stats
|
|
31
|
-
|
|
31
|
+
total_kb = (s[:total_bytes] / 1024.0).round(2)
|
|
32
32
|
fill_pct = (s[:fill_ratio] * 100).round(2)
|
|
33
|
-
|
|
34
|
-
"#<FastBloomFilter::Filter
|
|
35
|
-
"
|
|
33
|
+
|
|
34
|
+
"#<FastBloomFilter::Filter v2 layers=#{s[:num_layers]} " \
|
|
35
|
+
"count=#{s[:total_count]} size=#{total_kb}KB fill=#{fill_pct}%>"
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
def to_s
|
|
39
39
|
inspect
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
|
-
|
|
43
|
-
def self.for_emails(
|
|
44
|
-
Filter.new(
|
|
42
|
+
|
|
43
|
+
def self.for_emails(error_rate: 0.001, initial_capacity: 10_000)
|
|
44
|
+
Filter.new(error_rate: error_rate, initial_capacity: initial_capacity)
|
|
45
45
|
end
|
|
46
|
-
|
|
47
|
-
def self.for_urls(
|
|
48
|
-
Filter.new(
|
|
46
|
+
|
|
47
|
+
def self.for_urls(error_rate: 0.01, initial_capacity: 10_000)
|
|
48
|
+
Filter.new(error_rate: error_rate, initial_capacity: initial_capacity)
|
|
49
49
|
end
|
|
50
50
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fast_bloom_filter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Roman Haydarov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -66,10 +66,10 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '5.0'
|
|
69
|
-
description: Memory-efficient
|
|
70
|
-
Set, perfect for Rails apps.
|
|
69
|
+
description: Memory-efficient scalable Bloom Filter that grows dynamically. No upfront
|
|
70
|
+
capacity needed. 20-50x less memory than Set, perfect for Rails apps.
|
|
71
71
|
email:
|
|
72
|
-
-
|
|
72
|
+
- romnhajdarov@gmail.com
|
|
73
73
|
executables: []
|
|
74
74
|
extensions:
|
|
75
75
|
- ext/fast_bloom_filter/extconf.rb
|
|
@@ -82,13 +82,13 @@ files:
|
|
|
82
82
|
- ext/fast_bloom_filter/fast_bloom_filter.c
|
|
83
83
|
- lib/fast_bloom_filter.rb
|
|
84
84
|
- lib/fast_bloom_filter/version.rb
|
|
85
|
-
homepage: https://github.com/
|
|
85
|
+
homepage: https://github.com/roman-haidarov/fast_bloom_filter
|
|
86
86
|
licenses:
|
|
87
87
|
- MIT
|
|
88
88
|
metadata:
|
|
89
|
-
homepage_uri: https://github.com/
|
|
90
|
-
source_code_uri: https://github.com/
|
|
91
|
-
changelog_uri: https://github.com/
|
|
89
|
+
homepage_uri: https://github.com/roman-haidarov/fast_bloom_filter
|
|
90
|
+
source_code_uri: https://github.com/roman-haidarov/fast_bloom_filter
|
|
91
|
+
changelog_uri: https://github.com/roman-haidarov/fast_bloom_filter/blob/main/CHANGELOG.md
|
|
92
92
|
post_install_message:
|
|
93
93
|
rdoc_options: []
|
|
94
94
|
require_paths:
|
|
@@ -104,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
104
104
|
- !ruby/object:Gem::Version
|
|
105
105
|
version: '0'
|
|
106
106
|
requirements: []
|
|
107
|
-
rubygems_version: 3.
|
|
107
|
+
rubygems_version: 3.3.27
|
|
108
108
|
signing_key:
|
|
109
109
|
specification_version: 4
|
|
110
|
-
summary:
|
|
110
|
+
summary: Scalable Bloom Filter in C for Ruby - grows automatically
|
|
111
111
|
test_files: []
|