You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finding hidden files can have a performance impact when there are hidden
directories in the working directory that contain many files, as the hidden_files array can become rather large, resulting in a long
start-up time while the target files are determined. Using a binary search
can cut down on this start-up time considerably.
As an example, on my machine, I have a .bundle directory containing my local
bundle, which contains tens of thousands of files. This causes the target_files
array to be quite large as a result. Scanning on these using Array#include?
becomes at worst O(n), while using a binary search will be on average O(log n).
This change reduced the start-up time on my Rubocop scans from around
100 seconds to around 15 seconds when analyzed using Benchmark.
Expected behavior
Quick start-up time.
Actual behavior
Potentially slow start-up time when a large number of hidden files are present.
Steps to reproduce the problem
Create a hidden directory containing a large number of files and run Rubocop.
The issue will worse as the number of files increases appreciably.
…ect hidden files
Finding hidden files can have a performance impact when there are hidden
directories in the working directory that contain many files, as the
`hidden_files` array can become rather large, resulting in a long
start-up time while the target files are determined. Using a binary search
can cut down on this start-up time considerably.
Finding hidden files can have a performance impact when there are hidden
directories in the working directory that contain many files, as the
hidden_files
array can become rather large, resulting in a longstart-up time while the target files are determined. Using a binary search
can cut down on this start-up time considerably.
As an example, on my machine, I have a
.bundle
directory containing my localbundle, which contains tens of thousands of files. This causes the
target_files
array to be quite large as a result. Scanning on these using
Array#include?
becomes at worst O(n), while using a binary search will be on average O(log n).
This change reduced the start-up time on my Rubocop scans from around
100 seconds to around 15 seconds when analyzed using
Benchmark
.Expected behavior
Quick start-up time.
Actual behavior
Potentially slow start-up time when a large number of hidden files are present.
Steps to reproduce the problem
Create a hidden directory containing a large number of files and run Rubocop.
The issue will worse as the number of files increases appreciably.
RuboCop version
The text was updated successfully, but these errors were encountered: