atomic-ruby 0.7.1 → 0.7.2

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: ed78c53bc97b5e75c87c0d41a6ca9c5ba86688acb0eafff182cdba2b45c1134b
4
- data.tar.gz: 143b41531bde38087ce81761977d7b283ed066880641370e25543424cf163a41
3
+ metadata.gz: df0115a62c1857c8f5c11cac42003d5ed1c91ec1c5b204d5b5cf093f25d5cab9
4
+ data.tar.gz: 67963d4c342b33e235a5cb320013388dc227d46311c80c1b19e029b4ff02bc1d
5
5
  SHA512:
6
- metadata.gz: 6ff9bf98c45ba8f404fbab1908befbb2a703d3067cf0739c7265996e7c7840a7bc8c8ffe5a6cbfe8608960679f3e6ba716f773e790c333420fe35f5b251355ec
7
- data.tar.gz: df712bfcc529dc67e3017204da3670a7502e438a4706befcfa7c595f37c6d8024ed33f35d061fa7beaa4cd2680fe263b319747177aa59a978888fbf2ee621cdb
6
+ metadata.gz: e26adf803f4e798808a736eabdb86dc8d4074a71231aa2806e15f84ea5c8c6a7770cc268fb412733702fb0c540d1392e01265bf3571c3d143165f51776f72c19
7
+ data.tar.gz: d788e9e25c29f26050095050357ddb64b31a132bd1c9d9e13604945eec2382744a0b94e9f946d97eec6721c73fa16d83e574fc5e3e0644a3101c8b97b9b9b833
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.2] - 2025-10-26
4
+
5
+ - Revert "Fix O(n) performance issue in `AtomicThreadPool#<<` by using linked list"
6
+
3
7
  ## [0.7.1] - 2025-10-26
4
8
 
5
9
  - Fix O(n) performance issue in `AtomicThreadPool#<<` by using linked list
data/README.md CHANGED
@@ -384,8 +384,8 @@ concurrent-ruby version: 1.3.5
384
384
  atomic-ruby version: 0.7.0
385
385
 
386
386
  Benchmark Results:
387
- Concurrent Ruby Thread Pool: 4.802586 seconds
388
- Atomic Ruby Atomic Thread Pool: 4.466127 seconds
387
+ Concurrent Ruby Thread Pool: 5.30284 seconds
388
+ Atomic Ruby Atomic Thread Pool: 5.019147 seconds
389
389
  ```
390
390
 
391
391
  </details>
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "atom"
4
- require_relative "linked_list"
5
4
 
6
5
  module AtomicRuby
7
6
  class AtomicThreadPool
@@ -18,7 +17,7 @@ module AtomicRuby
18
17
  @size = size
19
18
  @name = name
20
19
 
21
- @state = Atom.new(queue: LinkedList.new, shutdown: false)
20
+ @state = Atom.new(queue: [], shutdown: false)
22
21
  @started_threads = Atom.new(0)
23
22
  @threads = []
24
23
 
@@ -30,7 +29,7 @@ module AtomicRuby
30
29
  if current_state[:shutdown]
31
30
  current_state
32
31
  else
33
- current_state.merge(queue: current_state[:queue].prepend(work))
32
+ current_state.merge(queue: [*current_state[:queue], work])
34
33
  end
35
34
  end
36
35
  raise EnqueuedWorkAfterShutdownError if state[:shutdown]
@@ -84,7 +83,7 @@ module AtomicRuby
84
83
  current_state
85
84
  else
86
85
  work = current_state[:queue].first
87
- current_state.merge(queue: current_state[:queue].rest)
86
+ current_state.merge(queue: current_state[:queue].drop(1))
88
87
  end
89
88
  end
90
89
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtomicRuby
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young
@@ -29,7 +29,6 @@ files:
29
29
  - lib/atomic-ruby/atomic_boolean.rb
30
30
  - lib/atomic-ruby/atomic_count_down_latch.rb
31
31
  - lib/atomic-ruby/atomic_thread_pool.rb
32
- - lib/atomic-ruby/linked_list.rb
33
32
  - lib/atomic-ruby/version.rb
34
33
  homepage: https://github.com/joshuay03/atomic-ruby
35
34
  licenses:
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AtomicRuby
4
- class LinkedList
5
- Node = Data.define(:value, :next_node)
6
-
7
- def initialize(head = nil)
8
- @head = head
9
- end
10
-
11
- def prepend(value)
12
- self.class.new(Node.new(value, @head))
13
- end
14
-
15
- def first
16
- @head&.value
17
- end
18
-
19
- def rest
20
- self.class.new(@head&.next_node)
21
- end
22
-
23
- def empty?
24
- @head.nil?
25
- end
26
-
27
- def length
28
- count = 0
29
- current = @head
30
- while current
31
- count += 1
32
- current = current.next_node
33
- end
34
- count
35
- end
36
- end
37
- end