zip_kit 6.3.0 → 6.3.2
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/.github/workflows/ci.yml +31 -8
- data/CHANGELOG.md +9 -0
- data/IMPLEMENTATION_DETAILS.md +9 -35
- data/README.md +25 -11
- data/RUBYZIP_DIFFERENCES.md +1 -4
- data/lib/zip_kit/block_deflate.rb +8 -8
- data/lib/zip_kit/file_reader.rb +17 -17
- data/lib/zip_kit/output_enumerator.rb +11 -0
- data/lib/zip_kit/rails_streaming.rb +1 -1
- data/lib/zip_kit/railtie.rb +3 -1
- data/lib/zip_kit/remote_io.rb +4 -4
- data/lib/zip_kit/size_estimator.rb +14 -8
- data/lib/zip_kit/stream_crc32.rb +5 -5
- data/lib/zip_kit/streamer/heuristic.rb +8 -0
- data/lib/zip_kit/streamer.rb +23 -5
- data/lib/zip_kit/version.rb +1 -1
- data/lib/zip_kit/write_shovel.rb +1 -1
- data/lib/zip_kit/zip_writer.rb +20 -20
- data/rbi/zip_kit.rbi +75 -66
- data/zip_kit.gemspec +2 -0
- metadata +31 -9
- data/.document +0 -5
- data/.rspec +0 -1
- data/bench/buffered_crc32_bench.rb +0 -109
@@ -1,109 +0,0 @@
|
|
1
|
-
require "bundler"
|
2
|
-
Bundler.setup
|
3
|
-
|
4
|
-
require "benchmark"
|
5
|
-
require "benchmark/ips"
|
6
|
-
require_relative "../lib/zip_kit"
|
7
|
-
|
8
|
-
n_bytes = 5 * 1024 * 1024
|
9
|
-
r = Random.new
|
10
|
-
bytes = (0...n_bytes).map { r.bytes(1) }
|
11
|
-
buffer_sizes = [
|
12
|
-
1,
|
13
|
-
256,
|
14
|
-
512,
|
15
|
-
1024,
|
16
|
-
8 * 1024,
|
17
|
-
16 * 1024,
|
18
|
-
32 * 1024,
|
19
|
-
64 * 1024,
|
20
|
-
128 * 1024,
|
21
|
-
256 * 1024,
|
22
|
-
512 * 1024,
|
23
|
-
1024 * 1024,
|
24
|
-
2 * 1024 * 1024
|
25
|
-
]
|
26
|
-
|
27
|
-
Benchmark.ips do |x|
|
28
|
-
x.config(time: 5, warmup: 2)
|
29
|
-
buffer_sizes.each do |buf_size|
|
30
|
-
x.report "Single-byte <<-writes of #{n_bytes} using a #{buf_size} byte buffer" do
|
31
|
-
crc = ZipKit::WriteBuffer.new(ZipKit::StreamCRC32.new, buf_size)
|
32
|
-
bytes.each { |b| crc << b }
|
33
|
-
crc.to_i
|
34
|
-
end
|
35
|
-
end
|
36
|
-
x.compare!
|
37
|
-
end
|
38
|
-
|
39
|
-
__END__
|
40
|
-
|
41
|
-
Warming up --------------------------------------
|
42
|
-
Single-byte <<-writes of 5242880 using a 1 byte buffer
|
43
|
-
1.000 i/100ms
|
44
|
-
Single-byte <<-writes of 5242880 using a 256 byte buffer
|
45
|
-
1.000 i/100ms
|
46
|
-
Single-byte <<-writes of 5242880 using a 512 byte buffer
|
47
|
-
1.000 i/100ms
|
48
|
-
Single-byte <<-writes of 5242880 using a 1024 byte buffer
|
49
|
-
1.000 i/100ms
|
50
|
-
Single-byte <<-writes of 5242880 using a 8192 byte buffer
|
51
|
-
1.000 i/100ms
|
52
|
-
Single-byte <<-writes of 5242880 using a 16384 byte buffer
|
53
|
-
1.000 i/100ms
|
54
|
-
Single-byte <<-writes of 5242880 using a 32768 byte buffer
|
55
|
-
1.000 i/100ms
|
56
|
-
Single-byte <<-writes of 5242880 using a 65536 byte buffer
|
57
|
-
1.000 i/100ms
|
58
|
-
Single-byte <<-writes of 5242880 using a 131072 byte buffer
|
59
|
-
1.000 i/100ms
|
60
|
-
Single-byte <<-writes of 5242880 using a 262144 byte buffer
|
61
|
-
1.000 i/100ms
|
62
|
-
Single-byte <<-writes of 5242880 using a 524288 byte buffer
|
63
|
-
1.000 i/100ms
|
64
|
-
Single-byte <<-writes of 5242880 using a 1048576 byte buffer
|
65
|
-
1.000 i/100ms
|
66
|
-
Single-byte <<-writes of 5242880 using a 2097152 byte buffer
|
67
|
-
1.000 i/100ms
|
68
|
-
Calculating -------------------------------------
|
69
|
-
Single-byte <<-writes of 5242880 using a 1 byte buffer
|
70
|
-
0.054 (± 0.0%) i/s - 1.000 in 18.383019s
|
71
|
-
Single-byte <<-writes of 5242880 using a 256 byte buffer
|
72
|
-
0.121 (± 0.0%) i/s - 1.000 in 8.286061s
|
73
|
-
Single-byte <<-writes of 5242880 using a 512 byte buffer
|
74
|
-
0.124 (± 0.0%) i/s - 1.000 in 8.038112s
|
75
|
-
Single-byte <<-writes of 5242880 using a 1024 byte buffer
|
76
|
-
0.128 (± 0.0%) i/s - 1.000 in 7.828562s
|
77
|
-
Single-byte <<-writes of 5242880 using a 8192 byte buffer
|
78
|
-
0.123 (± 0.0%) i/s - 1.000 in 8.121586s
|
79
|
-
Single-byte <<-writes of 5242880 using a 16384 byte buffer
|
80
|
-
0.127 (± 0.0%) i/s - 1.000 in 7.872240s
|
81
|
-
Single-byte <<-writes of 5242880 using a 32768 byte buffer
|
82
|
-
0.126 (± 0.0%) i/s - 1.000 in 7.911816s
|
83
|
-
Single-byte <<-writes of 5242880 using a 65536 byte buffer
|
84
|
-
0.126 (± 0.0%) i/s - 1.000 in 7.917318s
|
85
|
-
Single-byte <<-writes of 5242880 using a 131072 byte buffer
|
86
|
-
0.127 (± 0.0%) i/s - 1.000 in 7.897223s
|
87
|
-
Single-byte <<-writes of 5242880 using a 262144 byte buffer
|
88
|
-
0.130 (± 0.0%) i/s - 1.000 in 7.675608s
|
89
|
-
Single-byte <<-writes of 5242880 using a 524288 byte buffer
|
90
|
-
0.130 (± 0.0%) i/s - 1.000 in 7.679886s
|
91
|
-
Single-byte <<-writes of 5242880 using a 1048576 byte buffer
|
92
|
-
0.128 (± 0.0%) i/s - 1.000 in 7.788439s
|
93
|
-
Single-byte <<-writes of 5242880 using a 2097152 byte buffer
|
94
|
-
0.128 (± 0.0%) i/s - 1.000 in 7.797839s
|
95
|
-
|
96
|
-
Comparison:
|
97
|
-
Single-byte <<-writes of 5242880 using a 262144 byte buffer: 0.1 i/s
|
98
|
-
Single-byte <<-writes of 5242880 using a 524288 byte buffer: 0.1 i/s - 1.00x slower
|
99
|
-
Single-byte <<-writes of 5242880 using a 1048576 byte buffer: 0.1 i/s - 1.01x slower
|
100
|
-
Single-byte <<-writes of 5242880 using a 2097152 byte buffer: 0.1 i/s - 1.02x slower
|
101
|
-
Single-byte <<-writes of 5242880 using a 1024 byte buffer: 0.1 i/s - 1.02x slower
|
102
|
-
Single-byte <<-writes of 5242880 using a 16384 byte buffer: 0.1 i/s - 1.03x slower
|
103
|
-
Single-byte <<-writes of 5242880 using a 131072 byte buffer: 0.1 i/s - 1.03x slower
|
104
|
-
Single-byte <<-writes of 5242880 using a 32768 byte buffer: 0.1 i/s - 1.03x slower
|
105
|
-
Single-byte <<-writes of 5242880 using a 65536 byte buffer: 0.1 i/s - 1.03x slower
|
106
|
-
Single-byte <<-writes of 5242880 using a 512 byte buffer: 0.1 i/s - 1.05x slower
|
107
|
-
Single-byte <<-writes of 5242880 using a 8192 byte buffer: 0.1 i/s - 1.06x slower
|
108
|
-
Single-byte <<-writes of 5242880 using a 256 byte buffer: 0.1 i/s - 1.08x slower
|
109
|
-
Single-byte <<-writes of 5242880 using a 1 byte buffer: 0.1 i/s - 2.39x slower
|