Feature #6002
closeduse IO#advise in FileUtils.compare_stream
Description
=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
Files
Updated by kosaki (Motohiro KOSAKI) about 12 years ago
- Status changed from Open to Assigned
- Assignee set to kosaki (Motohiro KOSAKI)
OK, approved.
Updated by kosaki (Motohiro KOSAKI) almost 12 years ago
- 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.