Skip to content

Commit 418ca7c

Browse files
committed
v0.8.0
1 parent 82fb10d commit 418ca7c

4 files changed

Lines changed: 43 additions & 25 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## [Unreleased]
22

3+
## [0.8.0] - 2025-11-01
4+
35
- Fix Ractor safety (requires Ruby 3.5+)
46
- Make `ArgumentError` messages consistent
57
- Implement write barriers for `Atom`

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,19 @@ puts "Atomic Ruby Atomic Bank Account: #{results[2].real.round(6)} seconds"
222222
```
223223
> bundle exec rake compile && bundle exec ruby examples/atom_benchmark.rb
224224
225-
ruby version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [arm64-darwin25]
225+
ruby version: ruby 3.5.0dev (2025-10-31T18:08:15Z master 980e18496e) +YJIT +PRISM [arm64-darwin25]
226226
concurrent-ruby version: 1.3.5
227-
atomic-ruby version: 0.7.0
227+
atomic-ruby version: 0.8.0
228228
229229
Balances:
230230
Synchronized Bank Account Balance: 975
231231
Concurrent Ruby Atomic Bank Account Balance: 975
232232
Atomic Ruby Atomic Bank Account Balance: 975
233233
234234
Benchmark Results:
235-
Synchronized Bank Account: 5.102692 seconds
236-
Concurrent Ruby Atomic Bank Account: 5.100103 seconds
237-
Atomic Ruby Atomic Bank Account: 5.096461 seconds
235+
Synchronized Bank Account: 5.105459 seconds
236+
Concurrent Ruby Atomic Bank Account: 5.101044 seconds
237+
Atomic Ruby Atomic Bank Account: 5.091892 seconds
238238
```
239239

240240
</details>
@@ -313,29 +313,29 @@ end
313313
```
314314
> bundle exec rake compile && bundle exec ruby examples/atomic_boolean_benchmark.rb
315315
316-
ruby version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [arm64-darwin25]
316+
ruby version: ruby 3.5.0dev (2025-10-31T18:08:15Z master 980e18496e) +YJIT +PRISM [arm64-darwin25]
317317
concurrent-ruby version: 1.3.5
318-
atomic-ruby version: 0.7.0
318+
atomic-ruby version: 0.8.0
319319
320320
Warming up --------------------------------------
321321
Synchronized Boolean Toggle
322-
93.000 i/100ms
322+
154.000 i/100ms
323323
Concurrent Ruby Atomic Boolean Toggle
324-
79.000 i/100ms
324+
127.000 i/100ms
325325
Atomic Ruby Atomic Boolean Toggle
326-
87.000 i/100ms
326+
139.000 i/100ms
327327
Calculating -------------------------------------
328328
Synchronized Boolean Toggle
329-
889.6133.0%) i/s (1.12 ms/i) - 4.464k in 5.022732s
329+
1.458k7.3%) i/s (685.85 μs/i) - 7.392k in 5.102733s
330330
Concurrent Ruby Atomic Boolean Toggle
331-
803.4182.5%) i/s (1.24 ms/i) - 4.029k in 5.017952s
331+
1.129k9.7%) i/s (886.10 μs/i) - 5.588k in 5.001783s
332332
Atomic Ruby Atomic Boolean Toggle
333-
1.037k3.1%) i/s (964.07 μs/i) - 5.220k in 5.037558s
333+
1.476k6.0%) i/s (677.44 μs/i) - 7.367k in 5.017482s
334334
335335
Comparison:
336-
Atomic Ruby Atomic Boolean Toggle: 1037.3 i/s
337-
Synchronized Boolean Toggle: 889.6 i/s - 1.17x slower
338-
Concurrent Ruby Atomic Boolean Toggle: 803.4 i/s - 1.29x slower
336+
Atomic Ruby Atomic Boolean Toggle: 1476.1 i/s
337+
Synchronized Boolean Toggle: 1458.1 i/s - same-ish: difference falls within error
338+
Concurrent Ruby Atomic Boolean Toggle: 1128.5 i/s - 1.31x slower
339339
```
340340

341341
</details>
@@ -353,6 +353,14 @@ require "benchmark"
353353
require "concurrent-ruby"
354354
require_relative "../lib/atomic-ruby"
355355

356+
def shareable_proc(&block)
357+
if AtomicRuby::RACTOR_SAFE
358+
Ractor.shareable_proc(&block)
359+
else
360+
block
361+
end
362+
end
363+
356364
results = []
357365

358366
2.times do |idx|
@@ -363,11 +371,11 @@ results = []
363371
end
364372

365373
100.times do
366-
pool << proc { sleep(0.2) }
374+
pool << shareable_proc { sleep(0.2) }
367375
end
368376

369377
100.times do
370-
pool << proc { 1_000_000.times.map(&:itself).sum }
378+
pool << shareable_proc { 1_000_000.times.map(&:itself).sum }
371379
end
372380

373381
pool.shutdown
@@ -391,13 +399,13 @@ puts "Atomic Ruby Atomic Thread Pool: #{results[1].real.round(6)} seconds"
391399
```
392400
> bundle exec rake compile && bundle exec ruby examples/atomic_thread_pool_benchmark.rb
393401
394-
ruby version: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [arm64-darwin25]
402+
ruby version: ruby 3.5.0dev (2025-10-31T18:08:15Z master 980e18496e) +YJIT +PRISM [arm64-darwin25]
395403
concurrent-ruby version: 1.3.5
396-
atomic-ruby version: 0.7.0
404+
atomic-ruby version: 0.8.0
397405
398406
Benchmark Results:
399-
Concurrent Ruby Thread Pool: 5.30284 seconds
400-
Atomic Ruby Atomic Thread Pool: 5.019147 seconds
407+
Concurrent Ruby Thread Pool: 5.13772 seconds
408+
Atomic Ruby Atomic Thread Pool: 4.893086 seconds
401409
```
402410

403411
</details>

examples/atomic_thread_pool_benchmark.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
require "concurrent-ruby"
55
require_relative "../lib/atomic-ruby"
66

7+
def shareable_proc(&block)
8+
if AtomicRuby::RACTOR_SAFE
9+
Ractor.shareable_proc(&block)
10+
else
11+
block
12+
end
13+
end
14+
715
results = []
816

917
2.times do |idx|
@@ -14,11 +22,11 @@
1422
end
1523

1624
100.times do
17-
pool << proc { sleep(0.2) }
25+
pool << shareable_proc { sleep(0.2) }
1826
end
1927

2028
100.times do
21-
pool << proc { 1_000_000.times.map(&:itself).sum }
29+
pool << shareable_proc { 1_000_000.times.map(&:itself).sum }
2230
end
2331

2432
pool.shutdown

lib/atomic-ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module AtomicRuby
4-
VERSION = "0.7.2"
4+
VERSION = "0.8.0"
55
end

0 commit comments

Comments
 (0)