type_balancer 0.1.4 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c93fa5dcb75821b9f9ea3340f06ca63d67f84781bcf90f13ac089abac7283b7
4
- data.tar.gz: fbfadcf9eed52f9f82a5f0a99f05fe3801c8529c32735f3d2eac5b0d42648a4b
3
+ metadata.gz: fa2741d3d75b46e223d47fa50688978cbcf3a8c6faf2866ccf97144a8459b64d
4
+ data.tar.gz: 927c67db18171fe13d151f4d720b163fa4494c24e9f0fb48508cc4cf91ff1444
5
5
  SHA512:
6
- metadata.gz: 316f4c79fb96b3ff7362a61a4524f2d08e67be712b23f6c1a6f36d4b24332ae58266ce2fbd6dd39a7deea190f9f2f9e965c0bafe94443dd24be571ed62f302fd
7
- data.tar.gz: 054a3439add0798dc20593ace1681734fbed87f4d162baeb9e41b6f672cbbb43c7c2b17cd67a92d2c1a4a047b9418707139c2168cdcbde08a105376af53eb39e
6
+ metadata.gz: 6afefaf19925b4281778baa1a8c8da2bec31301ea15d0d73056a182affc89f50103948af59a1e1ec82fd6355354882d1cbfcaadd27499737c68812c31da903bf
7
+ data.tar.gz: 73b8f72dbfef3c30618c65508355937c24ffde11e699eb069b470c68d83450b66806979ceb49e864a3e812fdbf3b7b6a8bf4b5557f3f3d40fdb48533ccd9268e
data/.rubocop.yml CHANGED
@@ -93,4 +93,7 @@ RSpec/Rails:
93
93
 
94
94
  # Disable PredicateMatcher cop that's causing errors
95
95
  RSpec/PredicateMatcher:
96
+ Enabled: false
97
+
98
+ Style/HashExcept:
96
99
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1] - 2025-05-01
4
+
5
+ ### Performance
6
+ - Major performance improvements in the sliding window strategy implementation:
7
+ - Optimized window position calculation algorithm
8
+ - Improved batch processing for large collections
9
+ - Enhanced type distribution handling
10
+ - Reduced memory usage and allocation
11
+ - Updated benchmark results showing consistent performance:
12
+ - Tiny collections (10 items): 8-13μs
13
+ - Small collections (100 items): 68-104μs
14
+ - Medium collections (1,000 items): 648ms-1.03ms
15
+ - Large collections (10,000 items): 6.6-10.0ms
16
+
17
+ ### Enhanced
18
+ - Improved test suite with more focused test cases
19
+ - Reduced test execution time by optimizing large-scale test data
20
+ - Better handling of type ordering in Calculator and BaseStrategy
21
+ - Enhanced quality.rb output formatting for better readability
22
+ - Simplified large_scale_balance_test.rb implementation
23
+
24
+ ### Fixed
25
+ - Rubocop violations:
26
+ - Disabled Style/HashExcept cop
27
+ - Added parameter list exceptions for complex method signatures
28
+ - Improved require statements in example scripts to use require_relative
29
+
30
+ ## [0.2.0] - 2025-04-30
31
+
32
+ ### Added
33
+ - Introduced strategy pattern for flexible balancing algorithms
34
+ - Added sliding window strategy as the default balancing algorithm
35
+ - Configurable window size (default: 10)
36
+ - Maintains both local and global type ratios
37
+ - Adaptive behavior for remaining items
38
+ - Added comprehensive strategy documentation in README and balance.md
39
+ - Added large scale balance test suite for thorough strategy validation
40
+
41
+ ### Enhanced
42
+ - Improved quality testing infrastructure
43
+ - Added quality:all rake task that runs both quality.rb and large_scale_balance_test.rb
44
+ - Enhanced CI workflow to run all quality checks
45
+ - Added strategy-specific test cases
46
+ - Updated documentation with detailed strategy explanations and use cases
47
+ - Added extensive test coverage for strategy system
48
+
49
+ ### Fixed
50
+ - Improved handling of type distribution in edge cases
51
+ - Better handling of remaining items when types are depleted
52
+ - Enhanced transition handling between windows
53
+
3
54
  ## [0.1.4] - 2025-04-29
4
55
 
5
56
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- type_balancer (0.1.4)
4
+ type_balancer (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -52,15 +52,69 @@ items = [
52
52
  # ... more items
53
53
  ]
54
54
 
55
- # Balance items by type
55
+ # Balance items by type (uses default sliding window strategy)
56
56
  balanced_items = TypeBalancer.balance(items, type_field: :type)
57
+
58
+ # Use sliding window strategy with custom window size
59
+ balanced_items = TypeBalancer.balance(items,
60
+ type_field: :type,
61
+ strategy: :sliding_window,
62
+ window_size: 25
63
+ )
57
64
  ```
58
65
 
59
66
  ## Balancing Collections with `TypeBalancer.balance`
60
67
 
61
68
  The primary method for balancing collections is `TypeBalancer.balance`. This method takes an array of items and distributes them by type, ensuring optimal spacing and respecting type ratios.
62
69
 
63
- **Basic Example:**
70
+ ### Available Strategies
71
+
72
+ TypeBalancer uses a strategy pattern to provide different balancing algorithms. Currently, the gem implements a sophisticated sliding window strategy as its default approach:
73
+
74
+ #### Sliding Window Strategy (Default)
75
+ The sliding window strategy balances items by examining a fixed-size window of items at a time (default size: 10). Within each window, it maintains the overall ratio of types while ensuring each type gets fair representation. This creates both local and global balance in your content distribution.
76
+
77
+ **When to Use Sliding Window Strategy:**
78
+ - Content feeds where users might stop scrolling at any point
79
+ - When you want to ensure diversity in any segment of your list
80
+ - When you need to maintain both local and global balance
81
+ - When you want to prevent long runs of the same type while still allowing some natural clustering
82
+
83
+ **Window Size Selection Guide:**
84
+ - Small windows (5-10): Strict local balance, ideal for shorter lists or when immediate diversity is critical
85
+ - Medium windows (15-25): Balance between local and global distribution
86
+ - Large windows (30+): More gradual transitions, better for preserving some natural clustering
87
+
88
+ ```ruby
89
+ # Basic usage with default window size (10)
90
+ balanced = TypeBalancer.balance(items, type_field: :type)
91
+
92
+ # Custom window size for stricter local balance
93
+ balanced = TypeBalancer.balance(items,
94
+ type_field: :type,
95
+ strategy: :sliding_window,
96
+ window_size: 5
97
+ )
98
+
99
+ # Larger window for more gradual transitions
100
+ balanced = TypeBalancer.balance(items,
101
+ type_field: :type,
102
+ strategy: :sliding_window,
103
+ window_size: 25
104
+ )
105
+
106
+ # With custom type ordering
107
+ balanced = TypeBalancer.balance(items,
108
+ type_field: :type,
109
+ strategy: :sliding_window,
110
+ window_size: 15,
111
+ type_order: %w[image video article]
112
+ )
113
+ ```
114
+
115
+ The strategy system is designed to be extensible, allowing for future implementations of different balancing algorithms as needed.
116
+
117
+ ### Basic Example
64
118
 
65
119
  ```ruby
66
120
  items = [
@@ -73,18 +127,25 @@ balanced = TypeBalancer.balance(items, type_field: :type)
73
127
  # => [ { type: 'article', ... }, { type: 'image', ... }, { type: 'video', ... }, ... ]
74
128
  ```
75
129
 
76
- **Custom Type Order:**
130
+ ### Custom Type Order
77
131
 
78
132
  You can specify a custom order for types using the `type_order` argument. This controls the priority of types in the balanced output.
79
133
 
80
134
  ```ruby
81
135
  # Prioritize images, then videos, then articles
82
- balanced = TypeBalancer.balance(items, type_field: :type, type_order: %w[image video article])
136
+ balanced = TypeBalancer.balance(items,
137
+ type_field: :type,
138
+ type_order: %w[image video article],
139
+ strategy: :sliding_window,
140
+ window_size: 15
141
+ )
83
142
  # => [ { type: 'image', ... }, { type: 'video', ... }, { type: 'article', ... }, ... ]
84
143
  ```
85
144
 
86
145
  - `type_field`: The key to use for type extraction (default: `:type`).
87
146
  - `type_order`: An array of type names (as strings) specifying the desired order.
147
+ - `strategy`: The balancing strategy to use (default: `:sliding_window`).
148
+ - `window_size`: Size of the sliding window for the sliding window strategy (default: 10).
88
149
 
89
150
  For more advanced usage and options, see [Detailed Balance Method Documentation](docs/balance.md).
90
151
 
data/Rakefile CHANGED
@@ -17,6 +17,24 @@ Rake::ExtensionTask.new('type_balancer') do |ext|
17
17
  ext.config_options = ['--with-cflags=-Wall -Wextra -O3']
18
18
  end
19
19
 
20
+ # Quality check tasks
21
+ namespace :quality do
22
+ desc 'Run basic quality checks'
23
+ task :basic do
24
+ puts "\nRunning basic quality checks..."
25
+ ruby '-I lib examples/quality.rb'
26
+ end
27
+
28
+ desc 'Run large scale balance tests'
29
+ task :large_scale do
30
+ puts "\nRunning large scale balance tests..."
31
+ ruby '-I lib examples/large_scale_balance_test.rb'
32
+ end
33
+
34
+ desc 'Run all quality checks'
35
+ task all: %i[basic large_scale]
36
+ end
37
+
20
38
  # Add GoogleTest task using CMake
21
39
  namespace :gtest do
22
40
  desc 'Build and run all GoogleTest tests'
@@ -62,7 +80,7 @@ task test_with_mocks: [:spec] do
62
80
  Rake::Task['gtest:all'].invoke
63
81
  end
64
82
 
65
- task default: [:test_with_mocks, 'lint:all']
83
+ task default: [:test_with_mocks, 'lint:all', 'quality:all']
66
84
 
67
85
  # Benchmark tasks
68
86
  namespace :benchmark do
@@ -9,9 +9,9 @@ Running benchmarks...
9
9
  Benchmarking Tiny Dataset (10 items)
10
10
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [aarch64-linux]
11
11
  Warming up --------------------------------------
12
- Ruby Implementation 12.737k i/100ms
12
+ Ruby Implementation 7.321k i/100ms
13
13
  Calculating -------------------------------------
14
- Ruby Implementation 126.497k9.6%) i/s (7.91 μs/i) - 254.740k in 2.033633s
14
+ Ruby Implementation 74.105k4.7%) i/s (13.49 μs/i) - 153.741k in 2.079077s
15
15
 
16
16
  Distribution Stats:
17
17
  Video: 4 (40.0%)
@@ -21,9 +21,9 @@ Article: 3 (30.0%)
21
21
  Benchmarking Small Dataset (100 items)
22
22
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [aarch64-linux]
23
23
  Warming up --------------------------------------
24
- Ruby Implementation 2.261k i/100ms
24
+ Ruby Implementation 996.000 i/100ms
25
25
  Calculating -------------------------------------
26
- Ruby Implementation 23.642k9.3%) i/s (42.30 μs/i) - 47.481k in 2.025722s
26
+ Ruby Implementation 10.032k0.8%) i/s (99.68 μs/i) - 20.916k in 2.085103s
27
27
 
28
28
  Distribution Stats:
29
29
  Video: 34 (34.0%)
@@ -33,9 +33,9 @@ Article: 33 (33.0%)
33
33
  Benchmarking Medium Dataset (1000 items)
34
34
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [aarch64-linux]
35
35
  Warming up --------------------------------------
36
- Ruby Implementation 248.000 i/100ms
36
+ Ruby Implementation 104.000 i/100ms
37
37
  Calculating -------------------------------------
38
- Ruby Implementation 2.417k19.4%) i/s (413.65 μs/i) - 6.944k in 3.022707s
38
+ Ruby Implementation 1.040k 1.4%) i/s (961.95 μs/i) - 3.120k in 3.001891s
39
39
 
40
40
  Distribution Stats:
41
41
  Video: 334 (33.4%)
@@ -45,9 +45,9 @@ Article: 333 (33.3%)
45
45
  Benchmarking Large Dataset (10000 items)
46
46
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [aarch64-linux]
47
47
  Warming up --------------------------------------
48
- Ruby Implementation 28.000 i/100ms
48
+ Ruby Implementation 10.000 i/100ms
49
49
  Calculating -------------------------------------
50
- Ruby Implementation 267.85512.7%) i/s (3.73 ms/i) - 812.000 in 3.093948s
50
+ Ruby Implementation 104.445 1.0%) i/s (9.57 ms/i) - 320.000 in 3.063901s
51
51
 
52
52
  Distribution Stats:
53
53
  Video: 3334 (33.34%)
@@ -9,9 +9,9 @@ Running benchmarks...
9
9
  Benchmarking Tiny Dataset (10 items)
10
10
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) +YJIT [aarch64-linux]
11
11
  Warming up --------------------------------------
12
- Ruby Implementation 14.779k i/100ms
12
+ Ruby Implementation 10.640k i/100ms
13
13
  Calculating -------------------------------------
14
- Ruby Implementation 157.751k10.4%) i/s (6.34 μs/i) - 325.138k in 2.085954s
14
+ Ruby Implementation 111.468k 0.9%) i/s (8.97 μs/i) - 223.440k in 2.004679s
15
15
 
16
16
  Distribution Stats:
17
17
  Video: 4 (40.0%)
@@ -21,9 +21,9 @@ Article: 3 (30.0%)
21
21
  Benchmarking Small Dataset (100 items)
22
22
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) +YJIT [aarch64-linux]
23
23
  Warming up --------------------------------------
24
- Ruby Implementation 2.795k i/100ms
24
+ Ruby Implementation 1.392k i/100ms
25
25
  Calculating -------------------------------------
26
- Ruby Implementation 30.774k7.0%) i/s (32.50 μs/i) - 61.490k in 2.007908s
26
+ Ruby Implementation 13.988k0.6%) i/s (71.49 μs/i) - 29.232k in 2.089823s
27
27
 
28
28
  Distribution Stats:
29
29
  Video: 34 (34.0%)
@@ -33,9 +33,9 @@ Article: 33 (33.0%)
33
33
  Benchmarking Medium Dataset (1000 items)
34
34
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) +YJIT [aarch64-linux]
35
35
  Warming up --------------------------------------
36
- Ruby Implementation 321.000 i/100ms
36
+ Ruby Implementation 145.000 i/100ms
37
37
  Calculating -------------------------------------
38
- Ruby Implementation 2.931k18.8%) i/s (341.19 μs/i) - 8.667k in 3.086876s
38
+ Ruby Implementation 1.436k 1.0%) i/s (696.60 μs/i) - 4.350k in 3.030548s
39
39
 
40
40
  Distribution Stats:
41
41
  Video: 334 (33.4%)
@@ -45,9 +45,9 @@ Article: 333 (33.3%)
45
45
  Benchmarking Large Dataset (10000 items)
46
46
  ruby 3.2.8 (2025-03-26 revision 13f495dc2c) +YJIT [aarch64-linux]
47
47
  Warming up --------------------------------------
48
- Ruby Implementation 35.000 i/100ms
48
+ Ruby Implementation 14.000 i/100ms
49
49
  Calculating -------------------------------------
50
- Ruby Implementation 356.22312.4%) i/s (2.81 ms/i) - 1.050k in 3.028643s
50
+ Ruby Implementation 142.517 0.7%) i/s (7.02 ms/i) - 434.000 in 3.045580s
51
51
 
52
52
  Distribution Stats:
53
53
  Video: 3334 (33.34%)
@@ -9,9 +9,9 @@ Running benchmarks...
9
9
  Benchmarking Tiny Dataset (10 items)
10
10
  ruby 3.3.7 (2025-01-15 revision be31f993d7) [aarch64-linux]
11
11
  Warming up --------------------------------------
12
- Ruby Implementation 11.284k i/100ms
12
+ Ruby Implementation 7.474k i/100ms
13
13
  Calculating -------------------------------------
14
- Ruby Implementation 126.984k6.9%) i/s (7.87 μs/i) - 259.532k in 2.054088s
14
+ Ruby Implementation 77.780k1.0%) i/s (12.86 μs/i) - 156.954k in 2.018142s
15
15
 
16
16
  Distribution Stats:
17
17
  Video: 4 (40.0%)
@@ -21,9 +21,9 @@ Article: 3 (30.0%)
21
21
  Benchmarking Small Dataset (100 items)
22
22
  ruby 3.3.7 (2025-01-15 revision be31f993d7) [aarch64-linux]
23
23
  Warming up --------------------------------------
24
- Ruby Implementation 749.000 i/100ms
24
+ Ruby Implementation 968.000 i/100ms
25
25
  Calculating -------------------------------------
26
- Ruby Implementation 19.547k15.9%) i/s (51.16 μs/i) - 38.199k in 2.007898s
26
+ Ruby Implementation 9.726k 1.3%) i/s (102.81 μs/i) - 20.328k in 2.090308s
27
27
 
28
28
  Distribution Stats:
29
29
  Video: 34 (34.0%)
@@ -33,9 +33,9 @@ Article: 33 (33.0%)
33
33
  Benchmarking Medium Dataset (1000 items)
34
34
  ruby 3.3.7 (2025-01-15 revision be31f993d7) [aarch64-linux]
35
35
  Warming up --------------------------------------
36
- Ruby Implementation 205.000 i/100ms
36
+ Ruby Implementation 101.000 i/100ms
37
37
  Calculating -------------------------------------
38
- Ruby Implementation 2.299k9.3%) i/s (434.98 μs/i) - 6.970k in 3.064546s
38
+ Ruby Implementation 970.6198.6%) i/s (1.03 ms/i) - 2.929k in 3.044643s
39
39
 
40
40
  Distribution Stats:
41
41
  Video: 334 (33.4%)
@@ -45,9 +45,9 @@ Article: 333 (33.3%)
45
45
  Benchmarking Large Dataset (10000 items)
46
46
  ruby 3.3.7 (2025-01-15 revision be31f993d7) [aarch64-linux]
47
47
  Warming up --------------------------------------
48
- Ruby Implementation 27.000 i/100ms
48
+ Ruby Implementation 9.000 i/100ms
49
49
  Calculating -------------------------------------
50
- Ruby Implementation 271.4254.8%) i/s (3.68 ms/i) - 837.000 in 3.091882s
50
+ Ruby Implementation 99.7431.0%) i/s (10.03 ms/i) - 306.000 in 3.068124s
51
51
 
52
52
  Distribution Stats:
53
53
  Video: 3334 (33.34%)
@@ -9,9 +9,9 @@ Running benchmarks...
9
9
  Benchmarking Tiny Dataset (10 items)
10
10
  ruby 3.3.7 (2025-01-15 revision be31f993d7) +YJIT [aarch64-linux]
11
11
  Warming up --------------------------------------
12
- Ruby Implementation 15.811k i/100ms
12
+ Ruby Implementation 11.095k i/100ms
13
13
  Calculating -------------------------------------
14
- Ruby Implementation 176.585k10.2%) i/s (5.66 μs/i) - 363.653k in 2.084636s
14
+ Ruby Implementation 118.143k 1.0%) i/s (8.46 μs/i) - 244.090k in 2.066282s
15
15
 
16
16
  Distribution Stats:
17
17
  Video: 4 (40.0%)
@@ -21,9 +21,9 @@ Article: 3 (30.0%)
21
21
  Benchmarking Small Dataset (100 items)
22
22
  ruby 3.3.7 (2025-01-15 revision be31f993d7) +YJIT [aarch64-linux]
23
23
  Warming up --------------------------------------
24
- Ruby Implementation 2.755k i/100ms
24
+ Ruby Implementation 1.488k i/100ms
25
25
  Calculating -------------------------------------
26
- Ruby Implementation 29.060k8.7%) i/s (34.41 μs/i) - 57.855k in 2.007501s
26
+ Ruby Implementation 14.650k2.2%) i/s (68.26 μs/i) - 29.760k in 2.032402s
27
27
 
28
28
  Distribution Stats:
29
29
  Video: 34 (34.0%)
@@ -33,9 +33,9 @@ Article: 33 (33.0%)
33
33
  Benchmarking Medium Dataset (1000 items)
34
34
  ruby 3.3.7 (2025-01-15 revision be31f993d7) +YJIT [aarch64-linux]
35
35
  Warming up --------------------------------------
36
- Ruby Implementation 328.000 i/100ms
36
+ Ruby Implementation 152.000 i/100ms
37
37
  Calculating -------------------------------------
38
- Ruby Implementation 3.619k10.0%) i/s (276.35 μs/i) - 10.824k in 3.027879s
38
+ Ruby Implementation 1.542k 1.0%) i/s (648.70 μs/i) - 4.712k in 3.057044s
39
39
 
40
40
  Distribution Stats:
41
41
  Video: 334 (33.4%)
@@ -45,9 +45,9 @@ Article: 333 (33.3%)
45
45
  Benchmarking Large Dataset (10000 items)
46
46
  ruby 3.3.7 (2025-01-15 revision be31f993d7) +YJIT [aarch64-linux]
47
47
  Warming up --------------------------------------
48
- Ruby Implementation 40.000 i/100ms
48
+ Ruby Implementation 14.000 i/100ms
49
49
  Calculating -------------------------------------
50
- Ruby Implementation 394.0974.8%) i/s (2.54 ms/i) - 1.200k in 3.053424s
50
+ Ruby Implementation 150.1430.7%) i/s (6.66 ms/i) - 462.000 in 3.077274s
51
51
 
52
52
  Distribution Stats:
53
53
  Video: 3334 (33.34%)
@@ -9,9 +9,9 @@ Running benchmarks...
9
9
  Benchmarking Tiny Dataset (10 items)
10
10
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [aarch64-linux]
11
11
  Warming up --------------------------------------
12
- Ruby Implementation 11.805k i/100ms
12
+ Ruby Implementation 6.495k i/100ms
13
13
  Calculating -------------------------------------
14
- Ruby Implementation 108.979k11.4%) i/s (9.18 μs/i) - 224.295k in 2.082118s
14
+ Ruby Implementation 75.827k 1.0%) i/s (13.19 μs/i) - 155.880k in 2.055940s
15
15
 
16
16
  Distribution Stats:
17
17
  Video: 4 (40.0%)
@@ -21,9 +21,9 @@ Article: 3 (30.0%)
21
21
  Benchmarking Small Dataset (100 items)
22
22
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [aarch64-linux]
23
23
  Warming up --------------------------------------
24
- Ruby Implementation 1.992k i/100ms
24
+ Ruby Implementation 960.000 i/100ms
25
25
  Calculating -------------------------------------
26
- Ruby Implementation 21.879k6.7%) i/s (45.71 μs/i) - 43.824k in 2.011722s
26
+ Ruby Implementation 9.600k0.9%) i/s (104.17 μs/i) - 19.200k in 2.000241s
27
27
 
28
28
  Distribution Stats:
29
29
  Video: 34 (34.0%)
@@ -33,9 +33,9 @@ Article: 33 (33.0%)
33
33
  Benchmarking Medium Dataset (1000 items)
34
34
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [aarch64-linux]
35
35
  Warming up --------------------------------------
36
- Ruby Implementation 248.000 i/100ms
36
+ Ruby Implementation 100.000 i/100ms
37
37
  Calculating -------------------------------------
38
- Ruby Implementation 2.004k25.1%) i/s (498.96 μs/i) - 5.704k in 3.120598s
38
+ Ruby Implementation 991.713 2.2%) i/s (1.01 ms/i) - 3.000k in 3.026621s
39
39
 
40
40
  Distribution Stats:
41
41
  Video: 334 (33.4%)
@@ -45,9 +45,9 @@ Article: 333 (33.3%)
45
45
  Benchmarking Large Dataset (10000 items)
46
46
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [aarch64-linux]
47
47
  Warming up --------------------------------------
48
- Ruby Implementation 17.000 i/100ms
48
+ Ruby Implementation 10.000 i/100ms
49
49
  Calculating -------------------------------------
50
- Ruby Implementation 264.18310.6%) i/s (3.79 ms/i) - 782.000 in 3.006879s
50
+ Ruby Implementation 100.530 1.0%) i/s (9.95 ms/i) - 310.000 in 3.083817s
51
51
 
52
52
  Distribution Stats:
53
53
  Video: 3334 (33.34%)
@@ -9,9 +9,9 @@ Running benchmarks...
9
9
  Benchmarking Tiny Dataset (10 items)
10
10
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [aarch64-linux]
11
11
  Warming up --------------------------------------
12
- Ruby Implementation 15.310k i/100ms
12
+ Ruby Implementation 8.785k i/100ms
13
13
  Calculating -------------------------------------
14
- Ruby Implementation 152.742k10.9%) i/s (6.55 μs/i) - 306.200k in 2.025235s
14
+ Ruby Implementation 112.980k 7.7%) i/s (8.85 μs/i) - 228.410k in 2.039442s
15
15
 
16
16
  Distribution Stats:
17
17
  Video: 4 (40.0%)
@@ -21,9 +21,9 @@ Article: 3 (30.0%)
21
21
  Benchmarking Small Dataset (100 items)
22
22
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [aarch64-linux]
23
23
  Warming up --------------------------------------
24
- Ruby Implementation 2.912k i/100ms
24
+ Ruby Implementation 1.477k i/100ms
25
25
  Calculating -------------------------------------
26
- Ruby Implementation 32.388k6.8%) i/s (30.88 μs/i) - 66.976k in 2.077301s
26
+ Ruby Implementation 14.639k1.2%) i/s (68.31 μs/i) - 29.540k in 2.018232s
27
27
 
28
28
  Distribution Stats:
29
29
  Video: 34 (34.0%)
@@ -33,9 +33,9 @@ Article: 33 (33.0%)
33
33
  Benchmarking Medium Dataset (1000 items)
34
34
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [aarch64-linux]
35
35
  Warming up --------------------------------------
36
- Ruby Implementation 368.000 i/100ms
36
+ Ruby Implementation 152.000 i/100ms
37
37
  Calculating -------------------------------------
38
- Ruby Implementation 3.646k14.2%) i/s (274.30 μs/i) - 10.672k in 3.009052s
38
+ Ruby Implementation 1.500k 3.4%) i/s (666.84 μs/i) - 4.560k in 3.044713s
39
39
 
40
40
  Distribution Stats:
41
41
  Video: 334 (33.4%)
@@ -45,9 +45,9 @@ Article: 333 (33.3%)
45
45
  Benchmarking Large Dataset (10000 items)
46
46
  ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +YJIT +PRISM [aarch64-linux]
47
47
  Warming up --------------------------------------
48
- Ruby Implementation 42.000 i/100ms
48
+ Ruby Implementation 15.000 i/100ms
49
49
  Calculating -------------------------------------
50
- Ruby Implementation 424.2615.2%) i/s (2.36 ms/i) - 1.302k in 3.077566s
50
+ Ruby Implementation 151.6563.3%) i/s (6.59 ms/i) - 465.000 in 3.070430s
51
51
 
52
52
  Distribution Stats:
53
53
  Video: 3334 (33.34%)