Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDK-1088) Remove unnecessary file enumeration loop during PDK build #553

Merged
merged 1 commit into from
Jul 18, 2018

Conversation

scotje
Copy link
Contributor

@scotje scotje commented Jul 18, 2018

Prior to this change, every call to PDK::Module::Build#ignored_files
resulted in a Find.find enumeration of the entire module tree to test
whether or not the target_dir should be added to the ignored_files
PathSpec.

The fundamental issue was that this enumeration happened on
every call when it should have been cached after the first call, but I
also refactored the check itself to use File.realdirpath and simple
string comparisons.

Before:

PS>Measure-Command { bundle exec pdk build --force | Out-Default }
pdk (INFO): Building puppetlabs-windows version 5.0.0
[*] Cleaning up after running unit tests.
pdk (INFO): Build of puppetlabs-windows has completed successfully. Built package can be found here: C:/Users/pdk-dev/sandbox/puppetlabs-windows/pkg/puppetlabs-windows-5.0.0.tar.gz


Days              : 0
Hours             : 0
Minutes           : 1
Seconds           : 21
Milliseconds      : 272
Ticks             : 812723994
TotalDays         : 0.000940652770833333
TotalHours        : 0.0225756665
TotalMinutes      : 1.35453999
TotalSeconds      : 81.2723994
TotalMilliseconds : 81272.3994

After:

PS>Measure-Command { bundle exec pdk build --force | Out-Default }
pdk (INFO): Building puppetlabs-windows version 5.0.0
[*] Cleaning up after running unit tests.
pdk (INFO): Build of puppetlabs-windows has completed successfully. Built package can be found here: C:/Users/pdk-dev/sandbox/puppetlabs-windows/pkg/puppetlabs-windows-5.0.0.tar.gz


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 15
Milliseconds      : 444
Ticks             : 154443436
TotalDays         : 0.000178753976851852
TotalHours        : 0.00429009544444444
TotalMinutes      : 0.257405726666667
TotalSeconds      : 15.4443436
TotalMilliseconds : 15444.3436

Prior to this change, every call to PDK::Module::Build#ignored_files
resulted in a Find.find enumeration of the entire module tree to test
whether or not the target_dir should be added to the ignored_files
PathSpec.

The fundamental issue was that this enumeration happened on
every call when it should have been cached after the first call, but I
also refactored the check itself to use File.realdirpath and simple
string comparisons.
@scotje scotje requested a review from rodjek July 18, 2018 21:02
@scotje
Copy link
Contributor Author

scotje commented Jul 18, 2018

cc @glennsarti

@scotje
Copy link
Contributor Author

scotje commented Jul 18, 2018

@rodjek Think we can sneak this into 1.6.1?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.807% when pulling 52b9629 on scotje:1088_fix_slow_build into 962d71d on puppetlabs:master.

Copy link
Contributor

@rodjek rodjek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️

@rodjek rodjek merged commit 9a9b458 into puppetlabs:master Jul 18, 2018
@scotje scotje deleted the 1088_fix_slow_build branch July 18, 2018 23:46
@chelnak chelnak added the bug label Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants