Created
February 9, 2015 20:27
-
-
Save maxlinc/2c17281d91666a511b26 to your computer and use it in GitHub Desktop.
Zip benchmark
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
require 'winrm-fs' | |
require 'benchmark' | |
manifest = 'files.txt' | |
files = File.read(manifest).lines | |
files = files.map do | file | | |
next if file =~ /COMMIT_EDITMSG/ | |
File.expand_path(file.strip, Dir.pwd) | |
end.compact | |
files.each do |file| | |
puts file unless File.directory?(file) || File.file?(file) | |
end | |
Benchmark.bmbm do | benchmark | | |
benchmark.report('zip') { `cat #{manifest} | zip zip_command.zip --names-stdin` } | |
benchmark.report('tempzipfile') do | |
begin | |
temp_zip = WinRM::FS::Core::TempZipFile.new | |
files.each { | file | temp_zip.add(file) } | |
temp_zip | |
rescue => e | |
@error = e | |
end | |
end | |
end | |
puts "WinRM failed with #{@error}" if @error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment