{"id":13879560,"url":"https://github.com/igorkasyanchuk/execution_time","last_synced_at":"2025-10-01T01:31:18.572Z","repository":{"id":66300839,"uuid":"263936175","full_name":"igorkasyanchuk/execution_time","owner":"igorkasyanchuk","description":"How fast is your code? See it directly in Rails console.","archived":false,"fork":false,"pushed_at":"2023-07-10T18:51:57.000Z","size":4876,"stargazers_count":115,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-12T18:33:56.308Z","etag":null,"topics":["performance","pry","rails","rails-application","rails-gem","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"https://www.railsjazz.com/","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/igorkasyanchuk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"MIT-LICENSE","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}},"created_at":"2020-05-14T14:21:42.000Z","updated_at":"2024-05-20T10:21:45.000Z","dependencies_parsed_at":"2024-04-12T12:41:08.747Z","dependency_job_id":null,"html_url":"https://github.com/igorkasyanchuk/execution_time","commit_stats":{"total_commits":14,"total_committers":4,"mean_commits":3.5,"dds":0.3571428571428571,"last_synced_commit":"7f149a72e434361f5e5ecddf33149a80801b7eba"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorkasyanchuk%2Fexecution_time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorkasyanchuk%2Fexecution_time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorkasyanchuk%2Fexecution_time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorkasyanchuk%2Fexecution_time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igorkasyanchuk","download_url":"https://codeload.github.com/igorkasyanchuk/execution_time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234808945,"owners_count":18890088,"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":["performance","pry","rails","rails-application","rails-gem","ruby","ruby-on-rails"],"created_at":"2024-08-06T08:02:25.238Z","updated_at":"2025-10-01T01:31:18.567Z","avatar_url":"https://github.com/igorkasyanchuk.png","language":"Ruby","funding_links":["https://buymeacoffee.com/igorkasyanchuk"],"categories":["Ruby"],"sub_categories":[],"readme":"# ExecutionTime\n\n[![\"Buy Me A Coffee\"](https://github.com/igorkasyanchuk/get-smart/blob/main/docs/snapshot-bmc-button-small.png?raw=true)](https://buymeacoffee.com/igorkasyanchuk)\n\nMonitor execution time and other metrics directly in `rails console`, similar to what you see after each request.\n\n`[METRICS]  Completed in 908.3ms | Allocations: 2894 | ActiveRecord: 0.9ms (queries: 13)`\n\n \u003cimg src=\"https://github.com/igorkasyanchuk/execution_time/blob/master/docs/execution_time_new.gif?raw=true\" width=\"90%\" /\u003e\n\n## Usage\n\nJust add this gem to the Gemfile and start `rails c`. After this try to do something like `User.first`.\n\nIf you want to measure few lines of code just wrap it with `begin/end`:\n\n```ruby\n[4] pry(main)\u003e begin\n[4] pry(main)*   User.first.first_name.size\n[4] pry(main)*   a = User.count + 1\n[4] pry(main)*   b = User.second.last_name.size\n[4] pry(main)* end\n  User Load (0.4ms)  SELECT \"users\".* FROM \"users\" ORDER BY \"users\".\"id\" ASC LIMIT $1  [[\"LIMIT\", 1]]\n   (3.6ms)  SELECT COUNT(*) FROM \"users\"\n  User Load (0.3ms)  SELECT \"users\".* FROM \"users\" ORDER BY \"users\".\"id\" ASC LIMIT $1 OFFSET $2  [[\"LIMIT\", 1], [\"OFFSET\", 1]]\n[METRICS]  Completed in 6.8ms | Allocations: 839 | ActiveRecord: 4.3ms (queries: 3)\n=\u003e 5\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'execution_time'\n```\n\nor\n\n```ruby\ngem \"irb\"\ngem \"execution_time\"\n\n# sometimes IRB is loaded after execution_time gem, so we need to load it first\n```\n\n## First run\n\nSometime you can see that there are more SQL queries or allocated objects because Ruby is just loading objects in memory or verifying connection to the DB.\n\n## How to disable/enable metrics output in the console\n\nIf you need to disable gem in the console you can do it by `ExecutionTime.disable!`. And later enable with `ExecutionTime.enable!`.\n\nBy default gem is enabled.\n\n\n## Contributing\n\nYou are welcome to contribute.\n\n## Contributos\n\n- https://github.com/nbulaj\n- https://github.com/ruban-thilak\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n[\u003cimg src=\"https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true\"\n/\u003e](https://www.railsjazz.com/?utm_source=github\u0026utm_medium=bottom\u0026utm_campaign=execution_time)\n\n[![\"Buy Me A Coffee\"](https://github.com/igorkasyanchuk/get-smart/blob/main/docs/snapshot-bmc-button.png?raw=true)](https://buymeacoffee.com/igorkasyanchuk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorkasyanchuk%2Fexecution_time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figorkasyanchuk%2Fexecution_time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorkasyanchuk%2Fexecution_time/lists"}