# Local profiler

Available options for RoRvsWild's local profiler.

RoRvsWild Local monitors the performance of requests in development environment. It shows most of the requests performance insights RoRvsWild.com displays. A big difference is everything works locally and no data is sent and recorded on our servers. You don’t even need an account to use it.

RoRvsWild Local renders a small button in the bottom left corner of your page showing the runtime of the current request. If you click on it, you get all the profiled sections ordered by impact, which is depending on the sections average runtime and the calls count. As on RoRvsWild.com, the bottleneck is always on the top of the list.

## Configuration

### Open files in your editor

By default, File:line links open in VsCode. You can change the default editor.

```yaml
# config/rorvswild.yml
development:
  # VSCode: vscode://file${path}:${line}
  # Sublime: subl://${path}:${line}
  editor_url: <%= ENV.fetch("RORVSWILD_EDITOR_URL", "vscode://file${path}:${line}") %>
```

If developers on your team don't use the same editor, it should be set with an env variable.

```shell
RORVSWILD_EDITOR_URL='subl://${path}:${line}' rails server
```

### Hide or change the widget position

```yaml
# config/rorvswild.yml

development:
  widget: top-right 
  
#accepted values : top-left, top-right, bottom-right, bottom-left (default), hidden
```

You can still access the profiler at `http://localhost:3000/rorvswild` if you choose to hide the widget.

### Turn on `cache_classes`

Be aware that the performances on your development machine may vary from the production server. Obviously because of the different hardware and database size. Also, Rails is reloading all the code in development environment and this takes quite a lot of time. To prevent this behaviour and better match the production, turn on `cache_classes` in your `config/environments/development.rb`:

```ruby
Rails.application.configure do
  config.cache_classes = true
end
```

If you are using `Rack::Deflater` middleware you won't see the small button in the corner. Because of the compression it is not possible to inject some JavaScript into the page. In that case visit `http://localhost:3000/rorvswild` to see the profiler.
