Description
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.
Fasterer alternatives and similar gems
Based on the "Code Analysis and Metrics" category.
Alternatively, view Fasterer alternatives based on common mentions on social networks and blogs.
-
Rubocop
DISCONTINUED. A Ruby static code analyzer and formatter, based on the community Ruby style guide. [Moved to: https://github.com/rubocop/rubocop] -
SimpleCov
Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites -
Flog
Flog reports the most tortured code in an easy to read pain report. The higher the score, the more pain the code is in. -
Traceroute
A Rake task gem that helps you find the unused routes and controller actions for your Rails 3+ app -
Flay
Flay analyzes code for structural similarities. Differences in literal values, variable, class, method names, whitespace, programming style, braces vs do/end, etc are all ignored. -
undercover
undercover warns about methods, classes and blocks that were changed without tests, to help you easily find untested code and reduce the number of bugs. It does so by analysing data from git diffs, code structure and SimpleCov coverage reports -
bundler-leak
Known-leaky gems verification for bundler: `bundle leak` to check your app and find leaky gems in your Gemfile :gem::droplet:
Nutrient - The #1 PDF SDK Library

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Fasterer or a related project?
README
Fasterer
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.
Installation
gem install fasterer
Usage
Run it from the root of your project:
fasterer
Example output
app/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
Configuration is done through the .fasterer.yml file. This can placed in the root of your project, or any ancestor folder.
Options:
- Turn off speed suggestions
- Blacklist files or complete folder paths
Example:
speedups:
rescue_vs_respond_to: true
module_eval: true
shuffle_first_vs_sample: true
for_loop_vs_each: true
each_with_index_vs_while: false
map_flatten_vs_flat_map: true
reverse_each_vs_reverse_each: true
select_first_vs_detect: true
sort_vs_sort_by: true
fetch_with_argument_vs_block: true
keys_each_vs_each_key: true
hash_merge_bang_vs_hash_brackets: true
block_vs_symbol_to_proc: true
proc_call_vs_yield: true
gsub_vs_tr: true
select_last_vs_reverse_detect: true
getter_vs_attr_reader: true
setter_vs_attr_writer: true
exclude_paths:
- 'vendor/**/*.rb'
- 'db/schema.rb'
Integrations
These 3rd-party integrations enable you to run fasterer
automatically
as part of a larger framework.
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.
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.
Github-action for running fasterer via reviewdog. Reviewdog provides a way to post review comments in pull requests.
Speedups TODO:
- find vs bsearch
- Array#count vs Array#size
- Enumerable#each + push vs Enumerable#map
- Hash#merge vs Hash#merge!
- String#casecmp vs String#downcase + ==
- String concatenation
- String#match vs String#start_with?/String#end_with?
- String#gsub vs String#sub
Contributing
- Fork it ( https://github.com/DamirSvrtan/fasterer/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request