Skip to content

Instantly share code, notes, and snippets.

@maxlinc
Created February 9, 2015 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxlinc/2c17281d91666a511b26 to your computer and use it in GitHub Desktop.
Save maxlinc/2c17281d91666a511b26 to your computer and use it in GitHub Desktop.
Zip benchmark
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