carbon_fiber 0.1.1 → 0.1.3

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: a0c3f9f01990a58fb52c448fbdee3096ec76de7f0afddc1852169bc1c3e369ce
4
- data.tar.gz: b3fedbdee7a29a1da90c9d45fafd2bc0896deb01d58f2a3aabae674776635ece
3
+ metadata.gz: e4912cee9b33c19f921ee9ac02bfb3b7522295d4036a026c4e01756f827268b1
4
+ data.tar.gz: a19ab53436bd10394f12ba6f0f0a91e0b62aac470865b86af932ba98922fb0fa
5
5
  SHA512:
6
- metadata.gz: 771c4d0647326a8f2ecf46c12bcc6fd3de8e9b2ff088a2d2baee4d26bc0fbdfde9d7b11b2e5e2ae6666905aab1b3e3e1b99c466e8bf70aa3f688c36b0ecdddef
7
- data.tar.gz: 07e290791c406ea66d2bb50f8a99d86cb563799056143e21d7159e19dff9c6c878e1602ae019008b73ce6c86c67d21baec00649b16cbd5c97d38bd3cdd9e6fae
6
+ metadata.gz: c59ef2c0819bc66a3ba7f4b19474d1f2b38404ac99e0dc018e1bdf4247008627aea99203b063817f746702be501d2b357ac67048ebd74ef4f059448e67e20d1e
7
+ data.tar.gz: a4703832a539939964ed9dcb535ee1813038a23fe94837457c8ddf5a8fea5e808552b40661bad6ae83091d2cbefc8c55f513a69a3d9671ffb8e6dee73bbfa821
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [0.1.3] - 2026-05-08
2
+
3
+ - Update to Zig 0.16.0; update libxev and zig.rb to the latest versions.
4
+ - Performance improvements. README updated with latest numbers.
5
+ - Improve benchmarking: default to 3 measured runs plus 1 warmup run. Now reporting `±CV%` and the delta column tags rows `(noisy)` when the change is within jitter. Add the ability to benchmark released vs. unreleased carbon_fiber.
6
+
7
+ ## [0.1.2] - 2026-04-29
8
+
9
+ - Fix the `x86_64-linux` precompiled gem (erroneously shipped an aarch64
10
+ `.so`).
11
+ - Add precompiled gems for `x86_64-linux-musl` and `aarch64-linux-musl`.
12
+
1
13
  ## [0.1.1] - 2026-04-29
2
14
 
3
15
  - Fix the macOS release build: rewrite the precompiled bundle's libruby reference to `@rpath/libruby.X.Y.dylib` and add `@executable_path/../lib` so the `arm64-darwin` gem loads on any Ruby install. Previously the install_name was a hardcoded path to the GitHub Actions tool-cache, causing dyld to refuse to load the bundle on user machines.
data/README.md CHANGED
@@ -50,18 +50,18 @@ end
50
50
 
51
51
  ## Performance
52
52
 
53
- AWS EC2 c7a.2xlarge, 8 dedicated vCPUs, Ubuntu 24.04 LTS, kernel 6.17, Ruby 4.0.2 + YJIT, io_uring. 5-run median.
53
+ AWS EC2 c7a.2xlarge, 8 dedicated vCPUs, Amazon Linux 2023, kernel 6.18.20, Ruby 4.0.2 + YJIT, io_uring. 5-run median.
54
54
 
55
55
  Some benchmarks:
56
56
 
57
57
  | Workload | Carbon Fiber | Async | Itsi | Carbon Fiber vs. Async |
58
58
  |---|---|---|---|---|
59
- | `http_server` | **48.175k req/s** | 37.409k req/s | 29.708k req/s | +29% |
60
- | `http_client_api` | **15.528k req/s** | 13.373k req/s | timeout | +16% |
61
- | `http_client_download` | **6.747k dl/s** | 5.920k dl/s | timeout | +14% |
62
- | `tcp_echo` | **50.392k ops/s** | 38.907k ops/s | 30.660k ops/s | +29% |
63
- | `cascading_timeout` | **4.659k ops/s** | 4.488k ops/s | error | +4% |
64
- | `connection_pool` | **4.989k co/s** | 4.912k co/s | 4.968k co/s | +2% |
59
+ | `http_server` | **49.380k req/s** | 30.823k req/s | 30.864k req/s | +60% |
60
+ | `http_client_api` | **19.500k req/s** | 16.721k req/s | timeout | +17% |
61
+ | `http_client_download` | **8.426k dl/s** | 7.062k dl/s | timeout | +19% |
62
+ | `tcp_echo` | **52.973k ops/s** | 32.330k ops/s | 32.046k ops/s | +64% |
63
+ | `cascading_timeout` | **4.668k ops/s** | 4.414k ops/s | error | +6% |
64
+ | `connection_pool` | **4.967k co/s** | 4.612k co/s | 4.954k co/s | +8% |
65
65
 
66
66
  Wins on most workloads against Async, Itsi, fiber_scheduler, io-event, and libev. [See detailed benchmarks →](#benchmarks)
67
67
 
@@ -256,7 +256,7 @@ If the native extension can't be loaded (on Windows, for example), a pure-Ruby f
256
256
 
257
257
  ## Benchmarks
258
258
 
259
- AWS EC2 c7a.2xlarge, 8 dedicated vCPUs, Ubuntu 24.04 LTS, kernel 6.17, Ruby 4.0.2 + YJIT, io_uring. 5-run median.
259
+ AWS EC2 c7a.2xlarge, 8 dedicated vCPUs, Amazon Linux 2023, kernel 6.18.20, Ruby 4.0.2 + YJIT, io_uring. 5-run median.
260
260
 
261
261
  ### Ruby Fiber Schedulers (leading ones): Carbon Fiber vs. Async vs. Itsi
262
262
 
@@ -264,14 +264,14 @@ Measuring pure Ruby Fiber Scheduler performance (`Fiber.set_scheduler`).
264
264
 
265
265
  | Workload | Unit | Carbon Fiber | Async | Itsi | Carbon Fiber vs. Async |
266
266
  |---|---|---|---|---|---|
267
- | `http_client_api` | req/s | **15,528** | 13,373 | timeout | +16% |
268
- | `http_client_download` | dl/s | **6,747** | 5,920 | timeout | +14% |
269
- | `http_server` | req/s | **48,175** | 37,409 | 29,708 | +29% |
270
- | `tcp_echo` | ops/s | **50,392** | 38,907 | 30,660 | +29% |
271
- | `connection_pool` | co/s | **4,989** | 4,912 | 4,968 | +2% |
272
- | `fan_out_gather` | cyc/s | 2,024 | 2,046 | **2,104** | −1% |
273
- | `db_query_mix` | qry/s | 1,660 | 1,652 | **1,662** | +0.5% |
274
- | `cascading_timeout` | ops/s | **4,659** | 4,488 | error | +4% |
267
+ | `http_client_api` | req/s | **19,500** | 16,721 | timeout | +17% |
268
+ | `http_client_download` | dl/s | **8,426** | 7,062 | timeout | +19% |
269
+ | `http_server` | req/s | **49,380** | 30,823 | 30,864 | +60% |
270
+ | `tcp_echo` | ops/s | **52,973** | 32,330 | 32,046 | +64% |
271
+ | `connection_pool` | co/s | **4,967** | 4,612 | 4,954 | +8% |
272
+ | `fan_out_gather` | cyc/s | 2,022 | 1,923 | **2,094** | +5% |
273
+ | `db_query_mix` | qry/s | 1,660 | 1,623 | **1,662** | +2% |
274
+ | `cascading_timeout` | ops/s | **4,668** | 4,414 | error | +6% |
275
275
 
276
276
  Enabling YJIT turned out to be very beneficial for Async as well—numbers here are with `--yjit` on both sides.
277
277
 
@@ -281,12 +281,12 @@ Swapped the io-event selector for Carbon Fiber's native backend. Same Async code
281
281
 
282
282
  | Workload | Unit | Stock Async | Carbon Fiber | Delta |
283
283
  |---|---|---|---|---|
284
- | `http_client_api` | req/s | 13,375 | **14,331** | +7.1% |
285
- | `http_client_download` | dl/s | 3,893 | **3,956** | +1.6% |
286
- | `task_churn` | task/s | **87,883** | 85,027 | −3.3% |
287
- | `condition_signal` | sig/s | 337,282 | **361,089** | +7.1% |
288
- | `cascading_timeout` | ops/s | 4,497 | **4,511** | +0.3% |
289
- | `tcp_throughput` | ops/s | 42,292 | **51,930** | +22.8% |
284
+ | `http_client_api` | req/s | 17,119 | **17,323** | +1.2% |
285
+ | `http_client_download` | dl/s | 2,263 | **2,474** | +9.3% |
286
+ | `task_churn` | task/s | 119,477 | **120,985** | +1.3% |
287
+ | `condition_signal` | sig/s | 44,887 | **46,921** | +4.5% |
288
+ | `cascading_timeout` | ops/s | 4,414 | **4,472** | +1.3% |
289
+ | `tcp_throughput` | ops/s | 32,606 | **48,214** | +47.9% |
290
290
 
291
291
  ### Examples of how to run benchmarks
292
292
 
@@ -124,6 +124,22 @@ module CarbonFiber
124
124
  flush_ready
125
125
  end
126
126
 
127
+ # Mirrors `Selector#kernel_sleep` on the native side so
128
+ # `Scheduler#kernel_sleep` can delegate to `@selector.kernel_sleep`
129
+ # in both paths. Branches on the duration: nil parks the fiber on
130
+ # the loop without a timer, non-positive yields, positive parks on
131
+ # a native timer for `duration` seconds.
132
+ def kernel_sleep(duration = nil)
133
+ if duration.nil?
134
+ transfer
135
+ elsif duration <= 0
136
+ self.yield
137
+ else
138
+ block(Fiber.current, duration)
139
+ end
140
+ true
141
+ end
142
+
127
143
  # Suspend the current fiber until unblocked or timed out.
128
144
  def block(fiber, timeout = nil)
129
145
  token = nil
@@ -169,15 +169,7 @@ module CarbonFiber
169
169
  # Intercept +Kernel#sleep+. Parks the fiber on a native timer.
170
170
  # @param duration [Float, nil] seconds to sleep; nil sleeps forever
171
171
  def kernel_sleep(duration = nil)
172
- if duration.nil?
173
- transfer
174
- elsif duration <= 0
175
- self.yield
176
- else
177
- block(nil, duration)
178
- end
179
-
180
- true
172
+ @selector.kernel_sleep(duration)
181
173
  end
182
174
 
183
175
  # Wait for I/O readiness on a file descriptor.
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CarbonFiber
4
4
  # @return [String] the current gem version
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.3"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carbon_fiber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Markin