[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / benchmark / file_rename.rb
blobbbb44aebace52054142bd0193d02a622cb6d19e6
1 # rename file
2 require 'tempfile'
4 max = 100_000
5 tmp = [ Tempfile.new('rename-a'), Tempfile.new('rename-b') ]
6 a, b = tmp.map { |x| x.path }
7 tmp.each { |t| t.close } # Windows can't rename files without closing them
8 max.times do
9   File.rename(a, b)
10   File.rename(b, a)
11 end