Feature #5337

Use outbufs in FileUtils.compare_stream

Added by Masaki Matsushita over 3 years ago. Updated over 3 years ago.

[ruby-core:39622]
Status:Closed
Priority:Normal
Assignee:-

Description

=begin
I propose using outbufs in FileUtils.compare_stream.
It will increase performance.

I executed the following code to performance test.

require 'fileutils'
require "stringio"

str = "hoge" * 100000000

a = StringIO.new(str)
b = StringIO.new(str)

FileUtils.compare_stream(a, b)

The following are results of time command.

present compare_stream:

1.27s user 0.69s system 96% cpu 2.036 total
1.38s user 0.69s system 96% cpu 2.152 total
1.12s user 0.24s system 98% cpu 1.379 total

patched compare_stream:

0.70s user 0.43s system 97% cpu 1.158 total
0.72s user 0.27s system 98% cpu 1.010 total
0.62s user 0.28s system 98% cpu 0.915 total

Patched ruby passes tests in test/fileutils.

=end

patch.diff Magnifier (646 Bytes) Masaki Matsushita, 09/19/2011 06:01 PM

Associated revisions

Revision 33297
Added by Ayumu AIZAWA over 3 years ago

  • lib/fileutils.rb (module FileUtils): improve performance of FileUtils.compare_stream. a patch by Masaki Matsushita. [Feature #5337]

Revision 33297
Added by Ayumu AIZAWA over 3 years ago

  • lib/fileutils.rb (module FileUtils): improve performance of FileUtils.compare_stream. a patch by Masaki Matsushita. [Feature #5337]

Revision 37465
Added by glass over 2 years ago

  • lib/fileutils.rb (module FileUtils): repatch [Feature #5337]. improve performance of FileUtils.compare_stream. [Feature #7028]

Revision 37465
Added by glass over 2 years ago

  • lib/fileutils.rb (module FileUtils): repatch [Feature #5337]. improve performance of FileUtils.compare_stream. [Feature #7028]

History

#1 Updated by Ayumu AIZAWA over 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r33297.
Masaki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/fileutils.rb (module FileUtils): improve performance of FileUtils.compare_stream. a patch by Masaki Matsushita. [Feature #5337]

Also available in: Atom PDF