Skip to content

Commit 82780e2

Browse files
committed
feat: gtihub actions run only PR
1 parent 5d55741 commit 82780e2

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

.github/workflows/ruby.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@
77

88
name: 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

1222
jobs:
1323
test:
14-
1524
runs-on: ubuntu-latest
1625
strategy:
1726
matrix:

benchmarks/multi_thread_comporess.rb renamed to benchmarks/multi_thread_streaming_comporess.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
require 'objspace'
55
require 'zstd-ruby'
66
require 'thread'
7-
require "zstds"
87

98
GUESSES = (ENV['GUESSES'] || 1000).to_i
109
THREADS = (ENV['THREADS'] || 1).to_i
@@ -22,7 +21,9 @@
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)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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)

0 commit comments

Comments
 (0)