ruby-changes:53394
From: hsbt <ko1@a...>
Date: Thu, 8 Nov 2018 00:55:19 +0900 (JST)
Subject: [ruby-changes:53394] hsbt:r65610 (trunk): Dir.children is available since Feature #11302. FileUtils uses
hsbt 2018-11-08 00:55:14 +0900 (Thu, 08 Nov 2018) New Revision: 65610 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65610 Log: Dir.children is available since Feature #11302. FileUtils uses Dir.each on an internal method encapsulated on a private class `Entry_#entry`, having no '.' neither '..' entries would make now superfluous a chained reject filtering. This change can improve the performance of these FileUtils methods when the provided path covers thousands of files or directories: - chmod_R - chown_R - remove_entry - remove_entry_secure - rm_r - remove_dir - copy_entry Related: Feature #13896 https://bugs.ruby-lang.org/issues/13896 [Feature #14109][Fix GH-1754] Co-Authored-By: esparta <esparta@g...> Modified files: trunk/lib/fileutils.rb Index: lib/fileutils.rb =================================================================== --- lib/fileutils.rb (revision 65609) +++ lib/fileutils.rb (revision 65610) @@ -1274,8 +1274,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1274 def entries opts = {} opts[:encoding] = ::Encoding::UTF_8 if fu_windows? - Dir.entries(path(), opts)\ - .reject {|n| n == '.' or n == '..' }\ + Dir.children(path, opts)\ .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/