b0VIM 7.4£¥-UÉ*LþZdanhac~dan/dev/gems/sig/Rakefile 3210#"! UtpžadiýžúçæÀ‚OêéèâÅĺ­˜kQ¿ » º ¹ ³ ˆ ‡ j ] ) % $ #  ö õ Ì ¹ Ÿ Œ q [ =     ò æ Þ Ý Ë ¿ · ± “ l k a ` Q ,     ä Ò Æ ¾ ¸ œ v u k j X F : 2   ï ã Û ¯ © ‡ [ Z P O : $ #  ôèàߨ–Š‚|T"! ìàʪŠ{qkjMA+ íÞÔÎÍ­¡‹iG8.('ø⽘‰yxic_^]WON=/ýütask default: :specend ruby "spec/sig_spec.rb"task :spec dodesc "Run specs"# Specs# # #end end x.compare! } end i += 1 contracts_instance.mul(1, 2) contracts_instance.sum(1, 2) while i < times i = 0 x.report("contracts"){ |times| } end i += 1 rubype_instance.mul(1, 2) rubype_instance.sum(1, 2) while i < times i = 0 x.report("rubype"){ |times| } end i += 1 sig_instance.mul(1, 2) sig_instance.sum(1, 2) while i < times i = 0 x.report("sig"){ |times| } end i += 1 pure_instance.mul(1, 2) pure_instance.sum(1, 2) while i < times i = 0 x.report("pure"){ |times| Benchmark.ips do |x| puts "contracts version: #{Contracts::VERSION}" contracts_instance = ContractsSum.new end end x * y def mul(x, y) Contract RespondTo[:to_i], RespondTo[:to_i] => Num end x + y def sum(x, y) Contract Num, Num => Num include Contracts class ContractsSum # - - - puts "rubype version: #{Rubype::VERSION}" rubype_instance = RubypeSum.new end typesig :mul, [:to_i, :to_i] => Numeric end x * y def mul(x, y) typesig :sum, [Numeric, Numeric] => Numeric end x + y def sum(x, y) class RubypeSum # - - - puts "sig version: #{Sig::VERSION}" sig_instance = SigSum.new end end x * y def mul(x, y) sig [:to_i, :to_i], Numeric, end x + y def sum(x, y) sig [Numeric, Numeric], Numeric, class SigSum # - - - puts "ruby version: #{RUBY_VERSION}" pure_instance = PureSum.new end end x * y def mul(x, y) end x + y def sum(x, y) class PureSum # - - - require_relative "lib/sig" require "contracts/version" require "contracts" require "rubype/version" require "rubype" require "benchmark/ips"task :benchmark dodesc "Compare with contracts and rubype"# Benchmark: Take with a grain of salt# # #end sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"task :irb dodesc "#{gemspec.name} | IRB"# Start an IRB session with the gem loaded# # #end puts; sh %{gem install --no-document pkg/#{gemspec.name}-#{gemspec.version}.gem} FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg' FileUtils.mkdir_p 'pkg' print " "; sh "gem build #{gemspec_file}" puts info + "\n\n"task :gem dodesc info# Gem build and install task# # # "#{gemspec.files.size} files" "#{gemspec.runtime_dependencies.size} dependencies | " \info = "#{gemspec.name} | #{gemspec.version} | " \gemspec = eval File.read(gemspec_file), binding, gemspec_filegemspec_file = Dir['*.gemspec'].first# Get gemspec info# # #