From: Masaki Matsushita Date: 2012-02-13T09:30:21+09:00 Subject: [ruby-core:42514] [ruby-trunk - Feature #6002][Open] use IO#advise in FileUtils.compare_stream Issue #6002 has been reported by Masaki Matsushita. ---------------------------------------- Feature #6002: use IO#advise in FileUtils.compare_stream https://bugs.ruby-lang.org/issues/6002 Author: Masaki Matsushita Status: Open Priority: Normal Assignee: Category: lib Target version: =begin I propose to call IO#advise in FileUtils.compare_stream. It will increase performance. I created a dummy file: dd if=/dev/zero of=dummy bs=1M count=100 Then, I ran the following: require 'benchmark' require 'fileutils' path = "dummy" Benchmark.bm do |x| x.report do FileUtils.compare_file(path, path) end end I freed page cache before each test: sudo sysctl -w vm.drop_caches=1 results on Ubuntu 11.10(3.0.0-15-server): r34527: user system total real 0.050000 0.260000 0.310000 ( 0.353097) user system total real 0.030000 0.250000 0.280000 ( 0.320861) user system total real 0.070000 0.250000 0.320000 ( 0.391100) proposal: user system total real 0.050000 0.170000 0.220000 ( 0.235541) user system total real 0.020000 0.150000 0.170000 ( 0.188613) user system total real 0.030000 0.170000 0.200000 ( 0.201237) It shows the patch increases performance. =end -- http://bugs.ruby-lang.org/