summaryrefslogtreecommitdiff
path: root/benchmark/file_rename.yml
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/file_rename.yml')
-rw-r--r--benchmark/file_rename.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/benchmark/file_rename.yml b/benchmark/file_rename.yml
new file mode 100644
index 0000000..36a94d0
--- /dev/null
+++ b/benchmark/file_rename.yml
@@ -0,0 +1,15 @@
+prelude: |
+ # rename file
+benchmark:
+ file_rename: |
+ 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! }
+loop_count: 1