carbon_fiber 0.1.0 → 0.1.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +8 -8
- data/lib/carbon_fiber/native.rb +6 -3
- data/lib/carbon_fiber/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5d7027264dfb1b4d2751704427c0cb7a66f299d64ef09087961efa25e3e87de
|
|
4
|
+
data.tar.gz: 51293f770ecd63f98d587b41587accc1e2dfe638ae3b02247a5ec98fccec4ca3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac4fcb671a1cc24a5bf60b0bfefeba2c6a84a2f11bfee6036f1c0dc3fdc817a7b8dca09baea35ab5597ff42094a0967aad08f0188b635dbd1cf8da5a2d781a9e
|
|
7
|
+
data.tar.gz: d36a685b4dcc9fee84a1c8782418606ce933e1120da281eb4d50627b440301111cec5be41351d918538f6712bb8d5ae17f2e84bf5b78c29fc7938c4c5feb5457
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [0.1.2] - 2026-04-29
|
|
2
|
+
|
|
3
|
+
- Fix the `x86_64-linux` precompiled gem (erroneously shipped an aarch64
|
|
4
|
+
`.so`).
|
|
5
|
+
- Add precompiled gems for `x86_64-linux-musl` and `aarch64-linux-musl`.
|
|
6
|
+
|
|
7
|
+
## [0.1.1] - 2026-04-29
|
|
8
|
+
|
|
9
|
+
- 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.
|
|
10
|
+
- A native binary that exists on disk but fails to load now raises `LoadError` instead of silently falling back to the pure-Ruby implementation.
|
|
11
|
+
|
|
1
12
|
## [0.1.0] - 2026-04-14
|
|
2
13
|
|
|
3
14
|
- Initial release. Ruby Fiber Manager, Async backend, extensive benchmarking suite.
|
data/README.md
CHANGED
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
[](https://github.com/yaroslav/carbon_fiber/releases)
|
|
10
10
|
[](https://rubydoc.info/gems/carbon_fiber)
|
|
11
11
|
|
|
12
|
-
**Carbon Fiber is a Ruby Fiber Scheduler** with a native event loop (io_uring on Linux, kqueue on macOS). Install it, and your `Net::HTTP`, `TCPSocket`, `Mutex`, `Queue`, `Process.spawn` code becomes concurrent without any changes. Carbon Fiber also
|
|
12
|
+
**Carbon Fiber is a Ruby Fiber Scheduler** with a native event loop (io_uring on Linux, kqueue on macOS). Install it, and your `Net::HTTP`, `TCPSocket`, `Mutex`, `Queue`, `Process.spawn` code becomes concurrent without any changes. Carbon Fiber also works as a plug-and-play backend for the **Async framework** ([async gem](https://github.com/socketry/async)).
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
In my benchmarks (see below), Carbon Fiber is the **fastest pure Ruby Fiber Scheduler** currently available.
|
|
15
15
|
|
|
16
16
|
Carbon Fiber is implemented using the **Zig** programming language and is powered by **[libxev](https://github.com/mitchellh/libxev)** by Mitchell Hashimoto, used in his **Ghostty** terminal emulator. It is one of the first Ruby native extensions written in Zig.
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
- **Very fast.** My benchmarks
|
|
20
|
+
- **Very fast.** My benchmarks rank it as the fastest pure Ruby Fiber Scheduler overall. Uses **io_uring on Linux** and **kqueue on macOS**.
|
|
21
21
|
- **Plug and play with plain Ruby**, thanks to the Fiber Scheduler API—`Net::HTTP`, `TCPSocket`, `Process.spawn`, `Mutex`, `Queue`, DNS—all transparently concurrent under the scheduler; no gem-specific wrappers required.
|
|
22
22
|
- **Async (gem async) support** as a swappable backend. One call swaps the [Async](https://github.com/socketry/async) event loop for ours.
|
|
23
|
-
- **Pure-Ruby fallback**—when the native extension isn't available (Windows, for instance),
|
|
23
|
+
- **Pure-Ruby fallback**—when the native extension isn't available (Windows, for instance), Carbon Fiber uses a pure Ruby implementation behind the same API.
|
|
24
24
|
|
|
25
25
|
## Example
|
|
26
26
|
|
|
@@ -63,7 +63,7 @@ Some benchmarks:
|
|
|
63
63
|
| `cascading_timeout` | **4.659k ops/s** | 4.488k ops/s | error | +4% |
|
|
64
64
|
| `connection_pool` | **4.989k co/s** | 4.912k co/s | 4.968k co/s | +2% |
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Wins on most workloads against Async, Itsi, fiber_scheduler, io-event, and libev. [See detailed benchmarks →](#benchmarks)
|
|
67
67
|
|
|
68
68
|
---
|
|
69
69
|
|
|
@@ -72,7 +72,7 @@ On my workloads, wins almost all workloads across Async, Itsi, fiber_scheduler,
|
|
|
72
72
|
- Ruby 3.4 or 4.0.
|
|
73
73
|
- Linux (amd64 or arm64), macOS (Apple Silicon, x64 uses fallback*), Windows (fallback*).
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Ships precompiled—no Zig compiler required.
|
|
76
76
|
|
|
77
77
|
_\* Fallback means pure Ruby code, worse performance._
|
|
78
78
|
|
|
@@ -174,7 +174,7 @@ Alternatively, set the environment variable: `IO_EVENT_SELECTOR=CarbonFiberSelec
|
|
|
174
174
|
|
|
175
175
|
#### Example: Fan-out API calls
|
|
176
176
|
|
|
177
|
-
Call multiple upstream endpoints in parallel using `Async::Barrier`, then wait for all results.
|
|
177
|
+
Call multiple upstream endpoints in parallel using `Async::Barrier`, then wait for all results.
|
|
178
178
|
|
|
179
179
|
```ruby
|
|
180
180
|
require "async"
|
|
@@ -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, Ubuntu 24.04 LTS, kernel 6.17, 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
|
|
data/lib/carbon_fiber/native.rb
CHANGED
|
@@ -20,14 +20,17 @@ native_paths = [
|
|
|
20
20
|
)
|
|
21
21
|
]
|
|
22
22
|
|
|
23
|
+
# A native binary that exists but fails to load raises LoadError instead of
|
|
24
|
+
# silently falling back, so dyld/packaging bugs surface immediately.
|
|
23
25
|
native_loaded =
|
|
24
26
|
if ENV["CARBON_FIBER_FORCE_FALLBACK"] == "1"
|
|
25
27
|
false
|
|
26
28
|
else
|
|
27
|
-
native_paths.
|
|
28
|
-
|
|
29
|
+
existing = native_paths.find { |path| File.exist?(path) }
|
|
30
|
+
if existing
|
|
31
|
+
require existing
|
|
29
32
|
true
|
|
30
|
-
|
|
33
|
+
else
|
|
31
34
|
false
|
|
32
35
|
end
|
|
33
36
|
end
|
data/lib/carbon_fiber/version.rb
CHANGED