:zap: Don't make your Rubies go fast. Make them go fasterer ™. :zap:
:zap: Don't make your Rubies go fast. Make them go fasterer ™. :zap:
Make your Rubies go faster with this command line tool highly inspired by fast-ruby and Sferik's talk at Baruco Conf.
Fasterer will suggest some speed improvements which you can check in detail at the fast-ruby repo.
Please note that you shouldn't follow the suggestions blindly. Using a while loop instead of a each_with_index probably shouldn't be considered if you're doing a regular Rails project, but maybe if you're doing something very speed dependent such as Rack or if you're building your own framework, you might consider this speed increase.
gem install fastererRun it from the root of your project:
fastererapp/models/post.rb:57 Array#select.first is slower than Array#detect.
app/models/post.rb:61 Array#select.first is slower than Array#detect.
db/seeds/cities.rb:15 Hash#keys.each is slower than Hash#each_key.
db/seeds/cities.rb:33 Hash#keys.each is slower than Hash#each_key.
test/options_test.rb:84 Hash#merge! with one argument is slower than Hash#[].
test/module_test.rb:272 Don't rescue NoMethodError, rather check with respond_to?.
spec/cache/mem_cache_store_spec.rb:161 Use tr instead of gsub when grepping plain strings.Configuration is done through the .fasterer.yml file. This can placed in the root of your project, or any ancestor folder.
Options:
Example:
…These 3rd-party integrations enable you to run fasterer automatically
as part of a larger framework.
https://github.com/jumanjihouse/pre-commit-hooks
This integration allows to use fasterer as either a pre-commit hook or within CI.
It uses the https://pre-commit.com/ framework for managing and maintaining
multi-language pre-commit hooks.
https://github.com/prontolabs/pronto-fasterer
Pronto runner for Fasterer, speed improvements suggester. Pronto also integrates via danger-pronto into the danger framework for pull requests on Github, Gitlab, and BitBucket.
https://github.com/vk26/action-fasterer
Github-action for running fasterer via reviewdog. Reviewdog provides a way to post review comments in pull requests.
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)No open issues yet, or sync has not completed.