https://github.com/test-prof/railsconf2024-workshop
RailsConf 2024 workshop starter application
https://github.com/test-prof/railsconf2024-workshop
Last synced: 8 months ago
JSON representation
RailsConf 2024 workshop starter application
- Host: GitHub
- URL: https://github.com/test-prof/railsconf2024-workshop
- Owner: test-prof
- License: agpl-3.0
- Created: 2024-05-02T04:32:54.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-08T19:46:35.000Z (almost 2 years ago)
- Last Synced: 2025-04-12T06:43:51.545Z (12 months ago)
- Language: Ruby
- Size: 62.7 MB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
> [!IMPORTANT]
> This is a specific version of the original Mastodon codebase for [RailsConf 2024 workshop on tests profiling with TestProf](https://evilmartians.com/events/from-slow-to-go-rails-test-profiling-hands-on-railsconf-2024).
Mastodon is a **free, open-source social network server** based on ActivityPub where users can follow friends and discover new ones...
_See the full project's description [here](https://github.com/mastodon/mastodon)._
## Setting up for test profiling
First, install the following tools:
- [Docker](https://www.docker.com/products/docker-desktop/)
- [Dip](https://github.com/bibendi/dip)
Now, run Dip to provision Docker development enviroment enough to run **unit** tests (we don't need browser tests for this workshop):
```sh
dip provision
```
This command may take some time and should complete with success (you will see the message telling you about it).
Now, verify your setup by running all tests:
```sh
dip rspec
```
Make sure all is green. If not, don't hesitate to reach out (via issues).
Now, when everything is ready, you can open a terminal within a Docker container to start playing with TestProf:
```sh
dip runner
```
## Misc
### Additional profiling tools
We're going to analyze some flamegraphs and profiler reports during the workshop, so it's worth having them installed locally (to not depend on the Internet):
- `gem install profile-viewer`
- `npm install -g speedscope`
### Benchmarking
If you want to measure the effect of every optimization change made (and see the progress), you can use [hyperfine](https://github.com/sharkdp/hyperfine) as follows:
```sh
hyperfine -L commit "readme","debug require false","opt-in coverage","logging" --runs 2 --show-output --cleanup 'git checkout railsconf2024' --export-markdown 'tmp/results.md' "git -c advice.detachedHead=false checkout ':/{commit}' && dip rspec:notty"
```
The command above runs tests 2 times for specified commits (matching commit messages) and produces a markdown table. Feel free to adjust it to your needs!