File tree Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Original file line number Diff line number Diff line change 77
88name : Ruby
99
10- on : [push, pull_request]
10+ on :
11+ push :
12+ branches :
13+ - main
14+ paths-ignore :
15+ - ' README.md'
16+ pull_request :
17+
18+ concurrency :
19+ group : ${{ github.workflow }}-${{ github.ref }}
20+ cancel-in-progress : true
1121
1222jobs :
1323 test :
14-
1524 runs-on : ubuntu-latest
1625 strategy :
1726 matrix :
Original file line number Diff line number Diff line change 44require 'objspace'
55require 'zstd-ruby'
66require 'thread'
7- require "zstds"
87
98GUESSES = ( ENV [ 'GUESSES' ] || 1000 ) . to_i
109THREADS = ( ENV [ 'THREADS' ] || 1 ) . to_i
2221 while str = queue . pop
2322 stream = Zstd ::StreamingCompress . new
2423 stream << str
25- stream . finish
24+ res = stream . flush
25+ stream << str
26+ res << stream . finish
2627 end
2728 }
2829} . each ( &:join )
Original file line number Diff line number Diff line change 1+ require 'benchmark/ips'
2+ $LOAD_PATH. unshift '../lib'
3+ require 'json'
4+ require 'objspace'
5+ require 'zstd-ruby'
6+ require 'thread'
7+
8+ GUESSES = ( ENV [ 'GUESSES' ] || 1000 ) . to_i
9+ THREADS = ( ENV [ 'THREADS' ] || 1 ) . to_i
10+
11+ p GUESSES : GUESSES , THREADS : THREADS
12+
13+ sample_file_name = ARGV [ 0 ]
14+ json_string = File . read ( "./samples/#{ sample_file_name } " )
15+ target = Zstd . compress ( json_string )
16+
17+ queue = Queue . new
18+ GUESSES . times { queue << target }
19+ THREADS . times { queue << nil }
20+ THREADS . times . map {
21+ Thread . new {
22+ while str = queue . pop
23+ stream = Zstd ::StreamingDecompress . new
24+ stream . decompress ( str )
25+ stream . decompress ( str )
26+ end
27+ }
28+ } . each ( &:join )
You can’t perform that action at this time.
0 commit comments