{"id":13412068,"url":"https://github.com/DamirSvrtan/fasterer","last_synced_at":"2025-03-14T17:31:27.983Z","repository":{"id":27433907,"uuid":"30911832","full_name":"DamirSvrtan/fasterer","owner":"DamirSvrtan","description":":zap: Don't make your Rubies go fast. Make them go fasterer ™. :zap: ","archived":false,"fork":false,"pushed_at":"2024-06-14T12:04:43.000Z","size":218,"stargazers_count":1808,"open_issues_count":9,"forks_count":75,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-10-29T11:36:56.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DamirSvrtan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-17T10:12:26.000Z","updated_at":"2024-10-29T01:01:00.000Z","dependencies_parsed_at":"2023-11-13T07:28:46.546Z","dependency_job_id":"39a3a9d8-ee29-48c7-b6cd-2a0024a86b87","html_url":"https://github.com/DamirSvrtan/fasterer","commit_stats":{"total_commits":201,"total_committers":24,"mean_commits":8.375,"dds":0.263681592039801,"last_synced_commit":"e6e2f620f6b56c283ba9c6b52a88fe54cfb89383"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DamirSvrtan%2Ffasterer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DamirSvrtan%2Ffasterer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DamirSvrtan%2Ffasterer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DamirSvrtan%2Ffasterer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DamirSvrtan","download_url":"https://codeload.github.com/DamirSvrtan/fasterer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243119548,"owners_count":20239321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:20.683Z","updated_at":"2025-03-14T17:31:27.916Z","avatar_url":"https://github.com/DamirSvrtan.png","language":"Ruby","funding_links":[],"categories":["Ruby","Programming Languages","Awesome Ruby CLIs","Code Analysis and Metrics","Performances","Performance tools"],"sub_categories":["Profiling"],"readme":"[![Build Status](https://github.com/DamirSvrtan/fasterer/actions/workflows/ruby.yml/badge.svg)](https://github.com/DamirSvrtan/fasterer/actions/workflows/ruby.yml)\n[![Code Climate](https://codeclimate.com/github/DamirSvrtan/fasterer/badges/gpa.svg)](https://codeclimate.com/github/DamirSvrtan/fasterer)\n[![Gem Version](https://badge.fury.io/rb/fasterer.svg)](http://badge.fury.io/rb/fasterer)\n\n# Fasterer\n\nMake your Rubies go faster with this command line tool highly inspired by [fast-ruby](https://github.com/JuanitoFatas/fast-ruby) and [Sferik's talk at Baruco Conf](https://speakerdeck.com/sferik/writing-fast-ruby).\n\nFasterer will suggest some speed improvements which you can check in detail at the [fast-ruby repo](https://github.com/JuanitoFatas/fast-ruby).\n\n**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.\n\n\n\n## Installation\n\n```shell\ngem install fasterer\n```\n\n## Usage\n\nRun it from the root of your project:\n\n```shell\nfasterer\n```\n\n## Example output\n\n```\napp/models/post.rb:57 Array#select.first is slower than Array#detect.\napp/models/post.rb:61 Array#select.first is slower than Array#detect.\n\ndb/seeds/cities.rb:15 Hash#keys.each is slower than Hash#each_key.\ndb/seeds/cities.rb:33 Hash#keys.each is slower than Hash#each_key.\n\ntest/options_test.rb:84 Hash#merge! with one argument is slower than Hash#[].\n\ntest/module_test.rb:272 Don't rescue NoMethodError, rather check with respond_to?.\n\nspec/cache/mem_cache_store_spec.rb:161 Use tr instead of gsub when grepping plain strings.\n```\n## Configuration\n\nConfiguration is done through the **.fasterer.yml** file. This can placed in the root of your \nproject, or any ancestor folder.\n\nOptions:\n\n  * Turn off speed suggestions\n  * Blacklist files or complete folder paths\n\nExample:\n\n\n```yaml\nspeedups:\n  rescue_vs_respond_to: true\n  module_eval: true\n  shuffle_first_vs_sample: true\n  for_loop_vs_each: true\n  each_with_index_vs_while: false\n  map_flatten_vs_flat_map: true\n  reverse_each_vs_reverse_each: true\n  select_first_vs_detect: true\n  sort_vs_sort_by: true\n  fetch_with_argument_vs_block: true\n  keys_each_vs_each_key: true\n  hash_merge_bang_vs_hash_brackets: true\n  block_vs_symbol_to_proc: true\n  proc_call_vs_yield: true\n  gsub_vs_tr: true\n  select_last_vs_reverse_detect: true\n  getter_vs_attr_reader: true\n  setter_vs_attr_writer: true\n\nexclude_paths:\n  - 'vendor/**/*.rb'\n  - 'db/schema.rb'\n```\n\n## Integrations\n\nThese 3rd-party integrations enable you to run `fasterer` automatically\nas part of a larger framework.\n\n* https://github.com/jumanjihouse/pre-commit-hooks\n\n  This integration allows to use `fasterer` as either a pre-commit hook or within CI.\n  It uses the https://pre-commit.com/ framework for managing and maintaining\n  multi-language pre-commit hooks.\n\n* https://github.com/prontolabs/pronto-fasterer\n\n  Pronto runner for Fasterer, speed improvements suggester.\n  [Pronto](https://github.com/mmozuras/pronto) also integrates via\n  [danger-pronto](https://github.com/RestlessThinker/danger-pronto) into the\n  [danger](https://github.com/danger/danger) framework for pull requests\n  on Github, Gitlab, and BitBucket.\n\n* https://github.com/vk26/action-fasterer\n\n  Github-action for running fasterer via [reviewdog](https://github.com/reviewdog/reviewdog). Reviewdog provides a way to post review comments in pull requests.\n\n## Speedups TODO:\n\n4. find vs bsearch\n5. Array#count vs Array#size\n7. Enumerable#each + push vs Enumerable#map\n17. Hash#merge vs Hash#merge!\n20. String#casecmp vs String#downcase + ==\n21. String concatenation\n22. String#match vs String#start_with?/String#end_with?\n23. String#gsub vs String#sub\n\n## Contributing\n\n1. Fork it ( https://github.com/DamirSvrtan/fasterer/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDamirSvrtan%2Ffasterer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDamirSvrtan%2Ffasterer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDamirSvrtan%2Ffasterer/lists"}