Skip to content

Instantly share code, notes, and snippets.

@maxlinc
Created February 9, 2015 20:27

Revisions

  1. maxlinc created this gist Feb 9, 2015.
    28 changes: 28 additions & 0 deletions benchmark.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    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