Skip to content

Releases: SpringMT/zstd-ruby

v1.5.6.6

23 May 15:18
Compare
Choose a tag to compare

What's Changed

  • feat: add "zstd-ruby/stream_writer" and "zstd-ruby/stream_reader" loading by @SpringMT in #85
  • fix: decompress with streaming compress binary by @SpringMT in #90

Full Changelog: v1.5.6.5...v1.5.6.6

v1.5.6.5

26 Apr 05:42
Compare
Choose a tag to compare

What's Changed

  • feat: unlock GVL for simple compression and decompression by @SpringMT in #84

Improvemnt

  • GVL unlocking is limited to streaming, but it is also unlocked for simple compression and decompression.
    • No action required.

Full Changelog: v1.5.6.4...v1.5.6.5

v1.5.6.4

16 Apr 06:41
Compare
Choose a tag to compare

What's Changed

Bug Fix

  • Fixed a memory leak when using Zstd.decompress().
    In versions 1.5.6.2 and 1.5.6.3, the context (ZSTD_DCtx) does not released after the decompression process was completed. This PR #81 addresses that issue.

  • Resolved a crash when using Zstd.compress().
    In versions 1.5.6.2 and 1.5.6.3, Zstd.compress() internally used ZSTD_compressStream2, but it was crashing due to incomplete consumption of the internal buffer when large bytes were received. Zstd.compress() now uses ZSTD_compress2 instead of ZSTD_compressStream2 to ensure it doesn’t crash when processing large bytes.

If you are using versions v1.5.6.2 or v1.5.6.3, please update to version v1.5.6.4.

Full Changelog: v1.5.6.3...v1.5.6.4

v1.5.6.3

13 Apr 15:14
Compare
Choose a tag to compare

What's Changed

  • Feature/unlock gvl for streaming compression/decompression by @SpringMT in #79

Full Changelog: v1.5.6.2...v1.5.6.3

Improvemnt

Unlock GVL for streaming compression/decompression

Zstd streaming compression/decompression is a CPU-only process that do not involve the ruby interpreter.
Therefore, it is possible to unlock the GVL, allowing for parallel multiple threads, thus fully utilizing CPU resources.

This program demonstrates the difference:
(in benckmarks)

Re-introduce #53

Streaming Compression

$LOAD_PATH.unshift '../lib'
require 'zstd-ruby'
require 'thread'

GUESSES = (ENV['GUESSES'] || 1000).to_i
THREADS = (ENV['THREADS'] || 1).to_i

p GUESSES: GUESSES, THREADS: THREADS

sample_file_name = ARGV[0]
json_string = File.read("./samples/#{sample_file_name}")

queue = Queue.new
GUESSES.times { queue << json_string }
THREADS.times { queue << nil }
THREADS.times.map {
  Thread.new {
    while str = queue.pop
      stream = Zstd::StreamingCompress.new
      stream << str
      res = stream.flush
      stream << str
      res << stream.finish
    end
  }
}.each(&:join)

Without this patch:

[springmt@MacBook-Pro] (main)✗ % time THREADS=4 bundle exec ruby multi_thread_streaming_comporess.rb city.json
{:GUESSES=>1000, :THREADS=>4}
THREADS=4 bundle exec ruby multi_thread_streaming_comporess.rb city.json  2.83s user 0.29s system 94% cpu 3.299 total

With the patch:

[springmt@MacBook-Pro] (feature/unlock-gvl)✗ % time THREADS=4 bundle exec ruby multi_thread_streaming_comporess.rb city.json
{:GUESSES=>1000, :THREADS=>4}
THREADS=4 bundle exec ruby multi_thread_streaming_comporess.rb city.json  3.33s user 0.36s system 266% cpu 1.385 total

Streaming Decompression

$LOAD_PATH.unshift '../lib'
require 'zstd-ruby'
require 'thread'

GUESSES = (ENV['GUESSES'] || 1000).to_i
THREADS = (ENV['THREADS'] || 1).to_i

p GUESSES: GUESSES, THREADS: THREADS

sample_file_name = ARGV[0]
json_string = File.read("./samples/#{sample_file_name}")
target = Zstd.compress(json_string)

queue = Queue.new
GUESSES.times { queue << target }
THREADS.times { queue << nil }
THREADS.times.map {
  Thread.new {
    while str = queue.pop
      stream = Zstd::StreamingDecompress.new
      stream.decompress(str)
      stream.decompress(str)
    end
  }
}.each(&:join)

Without this patch:

[springmt@MacBook-Pro] (main)✗ % time THREADS=4 bundle exec ruby multi_thread_streaming_decomporess.rb city.json
{:GUESSES=>1000, :THREADS=>4}
THREADS=4 bundle exec ruby multi_thread_streaming_decomporess.rb city.json  2.03s user 0.28s system 93% cpu 2.486 total

With the patch:

[springmt@MacBook-Pro] (feature/unlock-gvl)✗ % time THREADS=4 bundle exec ruby multi_thread_streaming_decomporess.rb city.json
{:GUESSES=>1000, :THREADS=>4}
THREADS=4 bundle exec ruby multi_thread_streaming_decomporess.rb city.json  2.49s user 0.49s system 227% cpu 1.310 total

v1.5.6.2

11 Apr 13:32
Compare
Choose a tag to compare

What's Changed

Feature

  • Zstd.compress supports :level and :dict keyword args
  • Zstd.decompress supports :dict keyward args
  • Zstd::StreamingCompress.new supports :level and :dict keyword args
  • Zstd::StreamingDecompress.new supports :dict keyword args

Improvemnt

  • Zstd.compress uses ZSTD_compressStream2 instead of ZSTD_compress
  • Zstd.decompress uses ZSTD_decompressDCtx instead of ZSTD_decompress

Both of these changes maintain compatibility with previous versions.

Deprecation

  • Zstd.compress_using_dict adds deprecation warning
    • use Zstd.compress with :dict keyword args
  • Zstd.decompress_using_dict adds deprecation warning
    • use Zstd.decompress with :dict keyword args
  • Zstd.compress with level args add deprecation warning
    • use Zstd.compress with :level keyword args
  • Zstd::StreamingCompress.new with level args add deprecation warning
    • use Zstd::StreamingCompress.new with :level keyword args

New Contributors

Full Changelog: v1.5.6.1...v1.5.6.2

v1.5.6.1

01 Apr 15:46
Compare
Choose a tag to compare

What's Changed

  • chore: Configure Renovate by @renovate in #68
  • feat: update bechmarks by @SpringMT in #72
  • docs: update benchmark result by @SpringMT in #73
  • fix: incompatible function pointer types at streaming_decompress_compact and streaming_compress_compact by @SpringMT in #75
    • Related with #74

New Contributors

Full Changelog: v1.5.6.0...v1.5.6.1

v1.5.6.0

29 Mar 01:47
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.5.5.1...v1.5.6.0

v1.5.5.1

29 Mar 00:51
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.5.5.0...v1.5.5.1

v1.5.5.0

08 Apr 15:24
ad0437e
Compare
Choose a tag to compare

Update zstd v1.5.5

What's Changed

Full Changelog: v1.5.4.1...v1.5.5.0

Release v1.5.4.1

21 Mar 16:30
Compare
Choose a tag to compare

Support skippable flame.