require "benchmark" require "fileutils" file_name = "30M.txt" open(file_name) do |src_file| Benchmark.bm do |x| x.report("cp") do FileUtils.cp(file_name, "30M_cp.txt") end x.report("write") do open("30M_write.txt", "w") do |dst_file| dst_file.write(src_file.read) end end end end /Users/maeshima/work/test/ruby% ruby bench_cp_and_write.rb user system total real cp 0.050000 0.200000 0.250000 ( 0.9782