Important
This is a specific version of the original Mastodon codebase for RailsConf 2024 workshop on tests profiling with TestProf.
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.
First, install the following tools:
Now, run Dip to provision Docker development enviroment enough to run unit tests (we don't need browser tests for this workshop):
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:
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:
dip runner
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
If you want to measure the effect of every optimization change made (and see the progress), you can use hyperfine as follows:
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!