Sha256: 87db252c56e23d127ec6e5542c44ed5a6200ce8504ba3e2b4e371b74a49fcdd3
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
require 'benchmark' MAX = 200000 puts "\nOld File.expand_path" Benchmark.bm(30) do |x| x.report("expand_path('foo/bar')") do str = "foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('C:/foo/bar')") do str = "C:/foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('//foo/bar')") do str = "//foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('foo//bar///')") do str = "foo//bar///" MAX.times{ File.expand_path(str) } end x.report("expand_path('~')") do str = "~" MAX.times{ File.expand_path(str) } end x.report("expand_path('')") do str = "" MAX.times{ File.expand_path(str) } end x.report("expand_path('', '~')") do MAX.times{ File.expand_path('', '~') } end end require 'win32/xpath' puts "\nNew File.expand_path\n" Benchmark.bm(30) do |x| x.report("expand_path('foo/bar')") do str = "foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('C:/foo/bar')") do str = "C:/foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('//foo/bar')") do str = "//foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('foo//bar///')") do str = "foo//bar///" MAX.times{ File.expand_path(str) } end x.report("expand_path('~')") do str = "~" MAX.times{ File.expand_path(str) } end x.report("expand_path('')") do str = "" MAX.times{ File.expand_path(str) } end x.report("expand_path('', '~')") do MAX.times{ File.expand_path('', '~') } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
win32-xpath-1.1.2 | bench/bench_win32_xpath.rb |
win32-xpath-1.1.1 | bench/bench_win32_xpath.rb |