From: "kosaki (Motohiro KOSAKI)" Date: 2012-06-14T16:50:19+09:00 Subject: [ruby-core:45646] [ruby-trunk - Feature #6002][Rejected] use IO#advise in FileUtils.compare_stream Issue #6002 has been updated by kosaki (Motohiro KOSAKI). Status changed from Assigned to Rejected akr-san, pointed out IO#advise may raise EINVAL exception when linux w/ tmpfs. (see [ruby-dev:45703]) Thus, we can't apply this patch. ---------------------------------------- Feature #6002: use IO#advise in FileUtils.compare_stream https://bugs.ruby-lang.org/issues/6002#change-27246 Author: Glass_saga (Masaki Matsushita) Status: Rejected Priority: Normal Assignee: kosaki (Motohiro KOSAKI) 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/