Replies: 2 comments 9 replies
-
Here's a simple benchmark to establish at least one fact. I made this change in diff --git a/exe/rubocop b/exe/rubocop
index 3dacabebe..d1f381711 100755
--- a/exe/rubocop
+++ b/exe/rubocop
@@ -3,8 +3,10 @@
$LOAD_PATH.unshift("#{__dir__}/../lib")
-require 'rubocop'
require 'benchmark'
+require_time = Benchmark.realtime do
+ require 'rubocop'
+end
cli = RuboCop::CLI.new
result = 0
@@ -13,5 +15,5 @@ time = Benchmark.realtime do
result = cli.run
end
-puts "Finished in #{time} seconds" if cli.options[:debug] || cli.options[:display_time]
+puts "Finished in #{require_time} + #{time} seconds" if cli.options[:debug] || cli.options[:display_time]
exit result Result: $ time ./exe/rubocop --display-time Gemfile
Inspecting 1 file
.
1 file inspected, no offenses detected
Finished in 0.6445538369989663 + 0.3408129759991425 seconds
real 0m1,081s
user 0m1,008s
sys 0m0,072s We see here that around two thirds of the time is spent in |
Beta Was this translation helpful? Give feedback.
3 replies
-
Maybe we should integrate https://github.com/fohte/rubocop-daemon ? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This article/research on the state of Ruby formatters was shared with me earlier today - https://github.com/gurgeous/ruby-formatters
There are some interesting data points there - like how much slower we are then the competition when it comes to formatting a single file (I think that's mostly because RuboCop's bootstrapping is much more complex than that of the average formatter and I'm assuming that the editors just keep starting a fresh RuboCop process). Probably we should come up with some improvements for editor integration (e.g. a daemon mode) that would prevent RuboCop from constantly going through the painful process of processing the configuration and finding all the target files. If someone from the @rubocop-hq/rubocop-core would like to do some benchmarks and float some performance improvement ideas that'd be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions