atomic-ruby 0.6.3 → 0.6.5

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: 7bcb1e13a90548c071e835a97a8bcd9190a98ea42c61079c579c2f5639bfb33d
4
- data.tar.gz: c6f7756161ea86cb1287517b0712b1cf1dbb87e38fb890d556858eef158462d7
3
+ metadata.gz: 456e4fcacc95b4ceaf41c86933754eb112532ec91f33aad3672f85abc49c92ca
4
+ data.tar.gz: 53e2e40cd821bc065218c61aa7be2a100add7e6071d51d409e36f87d3c520da3
5
5
  SHA512:
6
- metadata.gz: fe3d02349f06ffbdbf0ba161c27e706712f59bfd52d13a85e987de569115b93e989c184634889ed63a6e562f23119e7e5ed3665c995a1cdc8718f0624bdecd85
7
- data.tar.gz: 032336cc1f50c6c4b228cb01a53c3274fe79e618baf2b561c410aca0b5f5b654d326753caf51e4f17a5135704efec53561b8209218bfba8bd23ab134f49ad918
6
+ metadata.gz: 534e5ceb68455cfd921c5c2b4312e8cf36179bb324c047dfafbade88b3ecac46a91c4388039437dabd01a2262d60e3da628d2269d6f857547a3175c2783d2ab3
7
+ data.tar.gz: e12909f23008b2d50df62aa8d5488ba72d632d230a0f507362a9574882d1447a5c60cc6547a34dc52106b4cc42cf41af3d00fa65cfa43df69bdc9b37fa1e3048
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.5] - 2025-10-16
4
+
5
+ - Move shortcut aliases for `AtomicRuby` namespaced classes to respective files
6
+
7
+ ## [0.6.4] - 2025-10-15
8
+
9
+ - Fix Ractor safety by properly marking native extension methods as safe
10
+
3
11
  ## [0.6.3] - 2025-10-15
4
12
 
5
13
  - Standardize directory structure to fix native extension loading
data/README.md CHANGED
@@ -97,6 +97,9 @@ latch.wait
97
97
  p latch.count #=> 0
98
98
  ```
99
99
 
100
+ > [!NOTE]
101
+ > `Atom`, `AtomicBoolean`, and `AtomicCountDownLatch` are also Ractor safe.
102
+
100
103
  ## Benchmarks
101
104
 
102
105
  <details>
@@ -207,9 +210,9 @@ puts "Atomic Ruby Atomic Bank Account: #{results[2].real.round(6)} seconds"
207
210
  ```
208
211
  > bundle exec rake compile && bundle exec ruby examples/atom_benchmark.rb
209
212
 
210
- ruby version: ruby 3.4.4 (2025-05-14 revision a38531fd3f) +YJIT +PRISM [arm64-darwin24]
213
+ ruby version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [arm64-darwin25]
211
214
  concurrent-ruby version: 1.3.5
212
- atomic-ruby version: 0.4.0
215
+ atomic-ruby version: 0.6.4
213
216
 
214
217
  Balances:
215
218
  Synchronized Bank Account Balance: 975
@@ -217,9 +220,9 @@ Concurrent Ruby Atomic Bank Account Balance: 975
217
220
  Atomic Ruby Atomic Bank Account Balance: 975
218
221
 
219
222
  Benchmark Results:
220
- Synchronized Bank Account: 5.110062 seconds
221
- Concurrent Ruby Atomic Bank Account: 5.107966 seconds
222
- Atomic Ruby Atomic Bank Account: 5.107739 seconds
223
+ Synchronized Bank Account: 5.110797 seconds
224
+ Concurrent Ruby Atomic Bank Account: 5.118082 seconds
225
+ Atomic Ruby Atomic Bank Account: 5.087287 seconds
223
226
  ```
224
227
 
225
228
  </details>
@@ -298,29 +301,29 @@ end
298
301
  ```
299
302
  > bundle exec rake compile && bundle exec ruby examples/atomic_boolean_benchmark.rb
300
303
 
301
- ruby version: ruby 3.4.4 (2025-05-14 revision a38531fd3f) +YJIT +PRISM [arm64-darwin24]
304
+ ruby version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [arm64-darwin25]
302
305
  concurrent-ruby version: 1.3.5
303
- atomic-ruby version: 0.4.0
306
+ atomic-ruby version: 0.6.4
304
307
 
305
308
  Warming up --------------------------------------
306
309
  Synchronized Boolean Toggle
307
- 102.000 i/100ms
310
+ 103.000 i/100ms
308
311
  Concurrent Ruby Atomic Boolean Toggle
309
- 88.000 i/100ms
312
+ 84.000 i/100ms
310
313
  Atomic Ruby Atomic Boolean Toggle
311
- 109.000 i/100ms
314
+ 115.000 i/100ms
312
315
  Calculating -------------------------------------
313
316
  Synchronized Boolean Toggle
314
- 1.062k2.5%) i/s (941.81 μs/i) - 5.406k in 5.094827s
317
+ 1.052k3.9%) i/s (950.20 μs/i) - 5.356k in 5.097149s
315
318
  Concurrent Ruby Atomic Boolean Toggle
316
- 981.495 (± 3.5%) i/s (1.02 ms/i) - 4.928k in 5.027167s
319
+ 872.073 (± 3.2%) i/s (1.15 ms/i) - 4.368k in 5.013857s
317
320
  Atomic Ruby Atomic Boolean Toggle
318
- 1.274k (± 1.5%) i/s (784.70 μs/i) - 6.431k in 5.047458s
321
+ 1.214k (± 1.5%) i/s (823.94 μs/i) - 6.095k in 5.023014s
319
322
 
320
323
  Comparison:
321
- Atomic Ruby Atomic Boolean Toggle: 1274.4 i/s
322
- Synchronized Boolean Toggle: 1061.8 i/s - 1.20x slower
323
- Concurrent Ruby Atomic Boolean Toggle: 981.5 i/s - 1.30x slower
324
+ Atomic Ruby Atomic Boolean Toggle: 1213.7 i/s
325
+ Synchronized Boolean Toggle: 1052.4 i/s - 1.15x slower
326
+ Concurrent Ruby Atomic Boolean Toggle: 872.1 i/s - 1.39x slower
324
327
  ```
325
328
 
326
329
  </details>
@@ -376,13 +379,13 @@ puts "Atomic Ruby Atomic Thread Pool: #{results[1].real.round(6)} seconds"
376
379
  ```
377
380
  > bundle exec rake compile && bundle exec ruby examples/atomic_thread_pool_benchmark.rb
378
381
 
379
- ruby version: ruby 3.4.4 (2025-05-14 revision a38531fd3f) +YJIT +PRISM [arm64-darwin24]
382
+ ruby version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [arm64-darwin25]
380
383
  concurrent-ruby version: 1.3.5
381
- atomic-ruby version: 0.4.0
384
+ atomic-ruby version: 0.6.4
382
385
 
383
386
  Benchmark Results:
384
- Concurrent Ruby Thread Pool: 5.02207 seconds
385
- Atomic Ruby Atomic Thread Pool: 4.503302 seconds
387
+ Concurrent Ruby Thread Pool: 4.768847 seconds
388
+ Atomic Ruby Atomic Thread Pool: 4.401936 seconds
386
389
  ```
387
390
 
388
391
  </details>
@@ -68,6 +68,10 @@ static VALUE rb_cAtom_swap(VALUE self) {
68
68
  }
69
69
 
70
70
  RUBY_FUNC_EXPORTED void Init_atomic_ruby(void) {
71
+ #ifdef HAVE_RB_EXT_RACTOR_SAFE
72
+ rb_ext_ractor_safe(true);
73
+ #endif
74
+
71
75
  VALUE rb_mAtomicRuby = rb_define_module("AtomicRuby");
72
76
  VALUE rb_cAtom = rb_define_class_under(rb_mAtomicRuby, "Atom", rb_cObject);
73
77
 
@@ -75,8 +79,4 @@ RUBY_FUNC_EXPORTED void Init_atomic_ruby(void) {
75
79
  rb_define_method(rb_cAtom, "_initialize", rb_cAtom_initialize, 1);
76
80
  rb_define_method(rb_cAtom, "_value", rb_cAtom_value, 0);
77
81
  rb_define_method(rb_cAtom, "_swap", rb_cAtom_swap, 0);
78
-
79
- #ifdef HAVE_RB_EXT_RACTOR_SAFE
80
- rb_ext_ractor_safe(true);
81
- #endif
82
82
  }
@@ -17,3 +17,5 @@ module AtomicRuby
17
17
  end
18
18
  end
19
19
  end
20
+
21
+ Atom = AtomicRuby::Atom
@@ -41,3 +41,5 @@ module AtomicRuby
41
41
  end
42
42
  end
43
43
  end
44
+
45
+ AtomicBoolean = AtomicRuby::AtomicBoolean
@@ -34,3 +34,5 @@ module AtomicRuby
34
34
  end
35
35
  end
36
36
  end
37
+
38
+ AtomicCountDownLatch = AtomicRuby::AtomicCountDownLatch
@@ -86,3 +86,5 @@ module AtomicRuby
86
86
  end
87
87
  end
88
88
  end
89
+
90
+ AtomicThreadPool = AtomicRuby::AtomicThreadPool
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtomicRuby
4
- VERSION = "0.6.3"
4
+ VERSION = "0.6.5"
5
5
  end
data/lib/atomic-ruby.rb CHANGED
@@ -7,8 +7,3 @@ require_relative "atomic-ruby/atom"
7
7
  require_relative "atomic-ruby/atomic_boolean"
8
8
  require_relative "atomic-ruby/atomic_thread_pool"
9
9
  require_relative "atomic-ruby/atomic_count_down_latch"
10
-
11
- Atom = AtomicRuby::Atom
12
- AtomicBoolean = AtomicRuby::AtomicBoolean
13
- AtomicThreadPool = AtomicRuby::AtomicThreadPool
14
- AtomicCountDownLatch = AtomicRuby::AtomicCountDownLatch
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young