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
Is your feature request related to a problem? Please describe.
I am using CLI to generate a custom rule, so far there are around 15K offenses in my codebase. I want to display them as clang formatter, however, it is slow-ish.
Then I try emacs formatter, feeling that it is very fast compared to the clang. I dive deep into the code and see the code related to relative path in clang. The code is calling Dir.pwdas base_dir every timesmart_path called in the formatter.
Describe the solution you'd like
Perhaps when running rubocop it should not be called every time, I'd like to perform caching on Dir.pwd as calling it is expensive. Either caching in runtime using memoized class variable or set it as a CONST to ignore the recall.
Is your feature request related to a problem? Please describe.
I am using CLI to generate a custom rule, so far there are around 15K offenses in my codebase. I want to display them as
clang
formatter, however, it is slow-ish.Then I try
emacs
formatter, feeling that it is very fast compared to theclang
. I dive deep into the code and see the code related to relative path inclang
. The code is callingDir.pwd
as base_dir every timesmart_path
called in the formatter.Describe the solution you'd like
Perhaps when running rubocop it should not be called every time, I'd like to perform caching on
Dir.pwd
as calling it is expensive. Either caching in runtime using memoized class variable or set it as a CONST to ignore the recall.Describe alternatives you've considered
N/A
Additional context
I've made a benchmark, so far it is 1xx times slower if we keep the old non-cached way
Dir.pwd
. Greatly impact folks who are running it with a large number of offenses, or first time maybe.https://gist.github.com/keymastervn/16d2e08d1c62d172dd830a3634e7a8cf
The text was updated successfully, but these errors were encountered: