diff options
Diffstat (limited to 'benchmark/bm_file_rename.rb')
-rw-r--r-- | benchmark/bm_file_rename.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/benchmark/bm_file_rename.rb b/benchmark/bm_file_rename.rb new file mode 100644 index 0000000000..3bf6a5ef35 --- /dev/null +++ b/benchmark/bm_file_rename.rb @@ -0,0 +1,11 @@ +# rename file +require 'tempfile' + +max = 100_000 +tmp = [ Tempfile.new('rename-a'), Tempfile.new('rename-b') ] +a, b = tmp.map { |x| x.path } +max.times do + File.rename(a, b) + File.rename(b, a) +end +tmp.each { |t| t.close! } |