multi_compress 0.3.4 → 0.3.5
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 +13 -0
- data/GET_STARTED.md +6 -4
- data/README.md +2 -2
- data/ext/multi_compress/multi_compress.c +9 -0
- data/lib/multi_compress/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f30991dd0d788507bb43885eacc3ae6c131722b0c77428778e7e3176d6ef220
|
|
4
|
+
data.tar.gz: 53ccbd3e9bf75b8b5eb74a8a6d523baab825ec3492ac730dbe2f739732b724e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad1f3ad3d2ba84e5eec72c1c0b5fed2dade4b3f1dd96efc11b6454ec9f9af78e4829e070c7310283d6500ed71a4a9895334a9d91bd6a0c86f4e947a98c5b0706
|
|
7
|
+
data.tar.gz: 11369cc33cae0ecb46cf0e9c84e0bc35c72bd2f7cb1cec46425c5cbbc27dfcc9c2037d5e5ab75a4e23c721229577b7ede3aea7bfe7327644024d1be7af229c57
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.5]
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Lowered the minimum supported Ruby version to **2.7.1**.
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- Made Fiber Scheduler integration conditional on the presence of Ruby's `ruby/fiber/scheduler.h` C API.
|
|
10
|
+
Ruby 2.7.1 now builds and installs without the scheduler header; scheduler-aware execution remains enabled automatically on supported newer Rubies.
|
|
11
|
+
|
|
12
|
+
### Notes
|
|
13
|
+
- On Ruby 2.7.1, all public compression, decompression, streaming, dictionary, and IO APIs are available.
|
|
14
|
+
Fiber Scheduler coordination is unavailable on that runtime, so operations use the existing direct/NOGVL execution paths.
|
|
15
|
+
|
|
3
16
|
## [0.3.4]
|
|
4
17
|
|
|
5
18
|
### Changed
|
data/GET_STARTED.md
CHANGED
|
@@ -188,7 +188,7 @@ end
|
|
|
188
188
|
|
|
189
189
|
## Fiber-friendly Execution
|
|
190
190
|
|
|
191
|
-
Starting with **v0.2.0**, MultiCompress is
|
|
191
|
+
Starting with **v0.2.0**, MultiCompress is fiber-friendly on Ruby runtimes that expose the Fiber Scheduler C API and plays nicely with `Fiber::Scheduler`-based runtimes like [async](https://github.com/socketry/async) and [falcon](https://github.com/socketry/falcon). Ruby 2.7.1 is supported through the same public API, using direct/NOGVL execution because that runtime does not expose this scheduler API.
|
|
192
192
|
|
|
193
193
|
### The Problem It Solves
|
|
194
194
|
|
|
@@ -196,7 +196,7 @@ Compression is CPU-bound work. Historically, calling `zstd`/`lz4`/`brotli` from
|
|
|
196
196
|
|
|
197
197
|
### How It Works
|
|
198
198
|
|
|
199
|
-
When MultiCompress detects an active `Fiber::Scheduler`, it:
|
|
199
|
+
When the compiled Ruby runtime exposes the scheduler API and MultiCompress detects an active `Fiber::Scheduler`, it:
|
|
200
200
|
|
|
201
201
|
1. Spawns a **dedicated worker thread** via `rb_thread_create` to run the compression with the GVL released.
|
|
202
202
|
2. Parks the calling fiber with `rb_fiber_scheduler_block(scheduler, blocker, Qnil)`.
|
|
@@ -325,8 +325,10 @@ end
|
|
|
325
325
|
|
|
326
326
|
### Requirements
|
|
327
327
|
|
|
328
|
-
- Ruby **>=
|
|
329
|
-
-
|
|
328
|
+
- Ruby **>= 2.7.1**
|
|
329
|
+
- For Fiber Scheduler cooperation: a Ruby runtime exposing the Fiber Scheduler C API and a running `Fiber::Scheduler` — typically provided by `Async { ... }` or Falcon's web server
|
|
330
|
+
|
|
331
|
+
Ruby 2.7.1 supports all compression, decompression, streaming, dictionary, and IO APIs. It does not expose the Fiber Scheduler C API, so operations use the normal direct/NOGVL execution paths instead of scheduler coordination.
|
|
330
332
|
|
|
331
333
|
### No Code Changes Required
|
|
332
334
|
|
data/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Bundled library versions in the current release:
|
|
|
33
33
|
- **Zero external dependencies**: All C libraries are vendored and compiled
|
|
34
34
|
- **Unified API**: Same interface for all algorithms — just change the `algo:` parameter
|
|
35
35
|
- **Performance first**: Direct bindings to C libraries, minimal overhead
|
|
36
|
-
- **Fiber-friendly**:
|
|
36
|
+
- **Fiber-friendly when available**: On Ruby runtimes exposing the Fiber Scheduler C API, compression and decompression cooperate with an active `Fiber::Scheduler` — safe to use under `async`, `falcon`, or similar runtimes without blocking the event loop. On Ruby 2.7.1, the same API works through the normal direct/NOGVL execution paths. See [GET_STARTED.md](GET_STARTED.md) for details and examples.
|
|
37
37
|
- **Memory efficient**: Streaming support for large datasets, proper resource cleanup
|
|
38
38
|
- **Operationally focused**: Clear errors, comprehensive tests, and streaming support for practical workloads
|
|
39
39
|
|
|
@@ -174,7 +174,7 @@ Or use the build script:
|
|
|
174
174
|
|
|
175
175
|
## Requirements
|
|
176
176
|
|
|
177
|
-
- Ruby >=
|
|
177
|
+
- Ruby >= 2.7.1
|
|
178
178
|
- C compiler (gcc, clang)
|
|
179
179
|
|
|
180
180
|
## License
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#include <ruby.h>
|
|
2
2
|
#include <ruby/encoding.h>
|
|
3
3
|
#include <ruby/thread.h>
|
|
4
|
+
|
|
5
|
+
#ifdef HAVE_RUBY_FIBER_SCHEDULER_H
|
|
4
6
|
#include <ruby/fiber/scheduler.h>
|
|
7
|
+
#endif
|
|
5
8
|
#include <brotli/decode.h>
|
|
6
9
|
#include <brotli/encode.h>
|
|
7
10
|
#include <lz4.h>
|
|
@@ -616,10 +619,16 @@ static inline void enforce_output_and_ratio_limits(size_t total_output, size_t t
|
|
|
616
619
|
}
|
|
617
620
|
|
|
618
621
|
static VALUE current_fiber_scheduler(void) {
|
|
622
|
+
#ifdef HAVE_RUBY_FIBER_SCHEDULER_H
|
|
619
623
|
VALUE sched = rb_fiber_scheduler_current();
|
|
624
|
+
|
|
620
625
|
if (sched == Qnil || sched == Qfalse)
|
|
621
626
|
return Qnil;
|
|
627
|
+
|
|
622
628
|
return sched;
|
|
629
|
+
#else
|
|
630
|
+
return Qnil;
|
|
631
|
+
#endif
|
|
623
632
|
}
|
|
624
633
|
|
|
625
634
|
static int has_fiber_scheduler(void) {
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: multi_compress
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roman Haydarov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -336,14 +336,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
336
336
|
requirements:
|
|
337
337
|
- - ">="
|
|
338
338
|
- !ruby/object:Gem::Version
|
|
339
|
-
version:
|
|
339
|
+
version: 2.7.1
|
|
340
340
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
341
|
requirements:
|
|
342
342
|
- - ">="
|
|
343
343
|
- !ruby/object:Gem::Version
|
|
344
344
|
version: '0'
|
|
345
345
|
requirements: []
|
|
346
|
-
rubygems_version: 3.
|
|
346
|
+
rubygems_version: 3.4.22
|
|
347
347
|
signing_key:
|
|
348
348
|
specification_version: 4
|
|
349
349
|
summary: 'Modern fiber-friendly compression for Ruby: zstd, lz4, brotli in one gem'
|