Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup bootsnap to speedup TestRunnerTest #43558

Merged
merged 1 commit into from Oct 28, 2021

Conversation

casperisfine
Copy link
Contributor

@casperisfine casperisfine commented Oct 28, 2021

When running rails t we skip the "fork" optimization. Because of this Rails is loaded from scratch.

However the vast majority of the code is Rails and other gems so it's the same for all tests.

By setting up bootsnap we can dramatically speed it up.

main:

$ bin/test test/application/test_runner_test.rb -n test_run_single_file
Run options: -n test_run_single_file --seed 8478

.

Finished in 7.313216s, 0.1367 runs/s, 0.2735 assertions/s.

This branch:

$ bin/test test/application/test_runner_test.rb -n test_run_single_file
Run options: -n test_run_single_file --seed 60063

.

Finished in 2.751576s, 0.3634 runs/s, 0.7269 assertions/s.
1 runs, 2 assertions, 0 failures, 0 errors, 0 skips

@rails-bot rails-bot bot added the railties label Oct 28, 2021
When running `rails t` we skip the "fork" optimization. Because
of this Rails is loaded from scratch.

However the vast majority of the code is Rails and other gems
so it's the same for all tests.

By seting up bootsnap we can dramatically speed it up.

main:
```
$ bin/test test/application/test_runner_test.rb -n test_run_single_file
Run options: -n test_run_single_file --seed 8478

.

Finished in 7.313216s, 0.1367 runs/s, 0.2735 assertions/s.
```

This branch:
```
$ bin/test test/application/test_runner_test.rb -n test_run_single_file
Run options: -n test_run_single_file --seed 60063

.

Finished in 2.751576s, 0.3634 runs/s, 0.7269 assertions/s.
1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
```
@casperisfine
Copy link
Contributor Author

test/application/test_runner_test.rb
/usr/local/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/test_runner_test.rb
Run options: --seed 12870
 
# Running:
 
.....................................................................
 
Finished in 179.129634s, 0.3852 runs/s, 1.5352 assertions/s.
69 runs, 275 assertions, 0 failures, 0 errors, 0 skips

vs main

test/application/test_runner_test.rb
/usr/local/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/test_runner_test.rb
Run options: --seed 50206
 
# Running:
 
.....................................................................
 
Finished in 307.722595s, 0.2242 runs/s, 0.8937 assertions/s.
69 runs, 275 assertions, 0 failures, 0 errors, 0 skips

This job is no longer the CI bottleneck.

@byroot byroot merged commit 62542cc into rails:main Oct 28, 2021
@p8
Copy link
Member

p8 commented Oct 29, 2021

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants