-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from SpringMT/feature/unlock-gvl-simple-compre…
…ss-decompress feat: unlock GVL for simple compression and decompression
- Loading branch information
Showing
8 changed files
with
132 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
$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 | ||
Zstd.compress(json_string) | ||
end | ||
} | ||
}.each(&:join) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$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 | ||
Zstd.decompress(str) | ||
end | ||
} | ||
}.each(&:join) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters