File: cdir_read_from_stream_profile.rb

package info (click to toggle)
ruby-zip 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,120 kB
  • sloc: ruby: 9,958; makefile: 23
file content (22 lines) | stat: -rw-r--r-- 480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'bundler/setup'
require 'zip'
require 'stackprof'

DATA_DIR = File.expand_path('../test/data', __dir__)

zip_file = File.open(File.join(DATA_DIR, '100000-files.zip'), 'rb')
cdir = Zip::CentralDirectory.new

profile = StackProf.run(mode: :wall) do
  cdir.read_from_stream(zip_file)
end

zip_file.close

result = StackProf::Report.new(profile)
puts
result.print_text
puts "\n\n\n"
result.print_method(/Zip::CentralDirectory#read_from_stream/)