From bfa97d2ac03000b2335c9243f2e4fcc33610141c Mon Sep 17 00:00:00 2001 From: Igor Shpakov Date: Fri, 31 Jul 2015 20:07:56 +0100 Subject: speed improvement for remote_directory() resource problem: doing ls(path) for a very large directory with > 1.8mil files takes upwards of 10 minutes. solution: change filtering stage from files.reject! to files.reject files.reject! does in place filtering and it looks like it copies the whole array for every deletion. in my example it filtered out 300k rows, so that's 300k array copies. switching to files.reject decreases the runtime of that function from 650seconds down to 6-7 seconds. --- lib/chef/provider/remote_directory.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chef/provider/remote_directory.rb b/lib/chef/provider/remote_directory.rb index eaccce46cf..85ceb5cdae 100644 --- a/lib/chef/provider/remote_directory.rb +++ b/lib/chef/provider/remote_directory.rb @@ -67,7 +67,7 @@ class Chef ::File::FNM_DOTMATCH) # Remove current directory and previous directory - files.reject! do |name| + files = files.reject do |name| basename = Pathname.new(name).basename().to_s ['.', '..'].include?(basename) end -- cgit v1.2.1 From 831909c785953a78409ee0bd869730c7e1c83fc2 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 27 Aug 2015 10:50:05 -0700 Subject: add md file --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c4153223c..22f02eee2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,10 +22,12 @@ * [**Nate Walck**](https://github.com/natewalck): [pr#3704](https://github.com/chef/chef/pull/3704): Add SIP (OS X 10.11) support * [**Phil Dibowitz**](https://github.com/jaymzh): + [pr#3805](https://github.com/chef/chef/pull/3805) LWRP parameter validators should use truthiness +* [**Igor Shpakov**](https://github.com/Igorshp): + [pr#3743](https://github.com/chef/chef/pull/3743) speed improvement for `remote_directory` resource * [pr#3799](https://github.com/chef/chef/pull/3799) fix supports hash issues in service providers * [pr#3817](https://github.com/chef/chef/pull/3817) Remove now-useless forcing of ruby Garbage Collector run -* [pr#3805](https://github.com/chef/chef/pull/3805) LWRP parameter validators should use truthiness * [pr#3774](https://github.com/chef/chef/pull/3774) Add support for yum-deprecated in yum provider * [pr#3793](https://github.com/chef/chef/pull/3793) CHEF-5372: Support specific `run_levels` for RedHat service * [pr#2460](https://github.com/chef/chef/pull/2460) add privacy flag -- cgit v1.2.1