atomic-ruby 0.16.0 → 0.16.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: ecdfa4ed4bb185acac2d6ce288418318e23c1e4825fddff06d74a702d19d0d39
4
- data.tar.gz: d2c935cb440869f1f622a30a585d71767ef57e3d08de78f332810e63acff1aa5
3
+ metadata.gz: b17a39b18e427bf9b4467457831fd5acf724af9d86b4ca35a3ef10582726b74e
4
+ data.tar.gz: 3285f13f8e5ef021f7fdbcbdcf52b17ab6ff171fc70106543799c0f09f577979
5
5
  SHA512:
6
- metadata.gz: 10e31be43b93f0d22de13ec3bea7f7d8bf411aa5282c5d36de2ee8da7693b968ab1aacbdc6c428317450670585bb857f0b8ecf657b71af6f18fcea9ab8c8c314
7
- data.tar.gz: d99ed0322536e33b725a5ddda3202eced49bc71de567d6505079d3fbcd8b11b4df9d2216c834a5b0fa546105860eef3ccf0848d4455870992061991be6f772aa
6
+ metadata.gz: 0b99a0e2100707aada701ed45c044cc06b6319bffe5a68ff996b8e536a42e1c1cd0ca36c092e9dfe6e24cfea03dd739cc1338b08926479ba2424d59a6a216221
7
+ data.tar.gz: 51d042574a1c3b9c8eb6b7606eaa3e6512ad97f9dbb72a38f349d40bc14eaa5b271e6953bac796ece002192ebd3831ac28ce6538e70297721eaa724cf12ab3bf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.16.1] - 2026-10-18
4
+
5
+ - Grow `AtomicThreadPool` until Ruby execution uses three quarters of one CPU
6
+
3
7
  ## [0.16.0] - 2026-10-18
4
8
 
5
9
  - Add `AtomicThreadPool#wait_for_capacity`
data/README.md CHANGED
@@ -270,7 +270,7 @@ puts "Atomic Ruby Atomic Bank Account: #{results[2].real.round(6)} seconds"
270
270
 
271
271
  ruby version: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin23]
272
272
  concurrent-ruby version: 1.3.8
273
- atomic-ruby version: 0.16.0
273
+ atomic-ruby version: 0.16.1
274
274
 
275
275
  Balances:
276
276
  Synchronized Bank Account Balance: 975
@@ -361,7 +361,7 @@ end
361
361
 
362
362
  ruby version: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin23]
363
363
  concurrent-ruby version: 1.3.8
364
- atomic-ruby version: 0.16.0
364
+ atomic-ruby version: 0.16.1
365
365
 
366
366
  Warming up --------------------------------------
367
367
  Synchronized Boolean Toggle 165.000 i/100ms
@@ -444,7 +444,7 @@ end
444
444
  > bundle exec rake clobber && bundle exec rake compile && bundle exec ruby examples/atomic_condition_variable_benchmark.rb
445
445
 
446
446
  ruby version: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin23]
447
- atomic-ruby version: 0.16.0
447
+ atomic-ruby version: 0.16.1
448
448
 
449
449
  Warming up --------------------------------------
450
450
  Synchronized Condition Variable Wait/Signal 4.062k i/100ms
@@ -519,7 +519,7 @@ end
519
519
  > bundle exec rake clobber && bundle exec rake compile && bundle exec ruby examples/atomic_queue_benchmark.rb
520
520
 
521
521
  ruby version: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin23]
522
- atomic-ruby version: 0.16.0
522
+ atomic-ruby version: 0.16.1
523
523
 
524
524
  Warming up --------------------------------------
525
525
  Synchronized Queue Push/Pop 184.000 i/100ms
@@ -622,7 +622,7 @@ puts "Atomic Ruby Adaptive Thread Pool: #{adaptive_results[1].real.round(6)} sec
622
622
 
623
623
  ruby version: ruby 4.0.7 (2026-09-15 revision 229531a6cf) +YJIT +PRISM [arm64-darwin23]
624
624
  concurrent-ruby version: 1.3.8
625
- atomic-ruby version: 0.16.0
625
+ atomic-ruby version: 0.16.1
626
626
 
627
627
  Fixed Pool Results:
628
628
  Concurrent Ruby Fixed Thread Pool: 5.147226 seconds
@@ -684,7 +684,7 @@ puts "Atomic Ruby Atomic Count Down Latch: #{results[1].total.round(6)} CPU seco
684
684
 
685
685
  ruby version: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +YJIT +PRISM [arm64-darwin23]
686
686
  concurrent-ruby version: 1.3.8
687
- atomic-ruby version: 0.16.0
687
+ atomic-ruby version: 0.16.1
688
688
 
689
689
  Benchmark Results:
690
690
  Concurrent Ruby Count Down Latch: 0.000511 CPU seconds, 2.001465 elapsed seconds
@@ -55,7 +55,8 @@ module AtomicRuby
55
55
  AUTOSCALE_INITIAL_WINDOW = 0.002
56
56
  AUTOSCALE_MAX_WINDOW = 0.05
57
57
  AUTOSCALE_SAMPLES_PER_WINDOW = 5
58
- private_constant :AUTOSCALE_IDLE_TIME, :AUTOSCALE_INITIAL_WINDOW, :AUTOSCALE_MAX_WINDOW, :AUTOSCALE_SAMPLES_PER_WINDOW
58
+ AUTOSCALE_RUBY_CPU_SHARE = 0.75
59
+ private_constant :AUTOSCALE_IDLE_TIME, :AUTOSCALE_INITIAL_WINDOW, :AUTOSCALE_MAX_WINDOW, :AUTOSCALE_SAMPLES_PER_WINDOW, :AUTOSCALE_RUBY_CPU_SHARE
59
60
 
60
61
  class Error < StandardError; end
61
62
 
@@ -393,7 +394,7 @@ module AtomicRuby
393
394
  if temporary && !@queue.empty?
394
395
  elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - work_started_at
395
396
  running_cpu_time = @thread_pool_monitor.snapshot[6] - running_cpu_time_at_start
396
- if running_cpu_time * 2 >= elapsed_time * 1_000_000_000
397
+ if running_cpu_time >= elapsed_time * 1_000_000_000 * AUTOSCALE_RUBY_CPU_SHARE
397
398
  @ruby_cpu_trim_requested.make_true
398
399
  @work_available.broadcast
399
400
  end
@@ -487,8 +488,9 @@ module AtomicRuby
487
488
  #
488
489
  # Requiring workers to spend a majority of their time blocked outside the
489
490
  # GVL recognizes blocking operations. The pool grows while Ruby execution
490
- # uses less than half of one CPU and shrinks when Ruby execution becomes
491
- # the bottleneck, without mistaking OS scheduling delays for GVL contention.
491
+ # uses less than three quarters of one CPU and shrinks when Ruby execution
492
+ # becomes the bottleneck, without mistaking OS scheduling delays for GVL
493
+ # contention.
492
494
  #
493
495
  # @param previous_snapshot [Array<Integer>] previous GVL state snapshot
494
496
  # @param snapshot [Array<Integer>] current GVL state snapshot
@@ -514,7 +516,7 @@ module AtomicRuby
514
516
  total_time = running_time + waiting_time + blocked_time
515
517
  end
516
518
 
517
- ruby_cpu_bound = running_cpu_time * 2 >= elapsed_time * 1_000_000_000
519
+ ruby_cpu_bound = running_cpu_time >= elapsed_time * 1_000_000_000 * AUTOSCALE_RUBY_CPU_SHARE
518
520
  blocking = total_time.positive? && blocked_time * 2 > total_time && !ruby_cpu_bound
519
521
 
520
522
  return :up if blocking && workers.length < @max_size
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtomicRuby
4
- VERSION = "0.16.0"
4
+ VERSION = "0.16.1"
5
5
  end
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.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young