repo.or.cz
/
ruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
[ruby/prism] Fix up doubled range in arguments
[ruby.git]
/
benchmark
/
file_rename.rb
blob
bbb44aebace52054142bd0193d02a622cb6d19e6
1
# rename file
2
require 'tempfile'
3
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