Is it possible to speed up test boot time?

I have recently created an editor (Neovim) plugin to integrate with Rails default testing framework - minitest. Here is the demo video. With this plugin, I can open my test file, and run all the tests or a single test and the result will be reflected inside the test file itself.

Things are going fine but I am hoping to make the process a little faster. If you watch the video you can see that the time taken from the start of running a single test case doing one assertion until the result is reflected in the editor takes around 4-5 seconds.

I did some checking on the time taken running this command:

time rails test test/models/user_test.rb

And here’s the result:

Things that I have looked into

  1. Gem load time (this is a very new project with only a few additional gems installed)
  2. Number of fixtures to load (I tried only load the fixtures needed for the current test file, but it doesn’t reduce the time much, again, this is a new project with only a few fixtures)

Appreciate it if anyone can give me some suggestions on if speeding up the test boot time is possible.

Thank you

Take a look at test.rb and ensure you have the config below or false for eager load:

config.eager_load = ENV["CI"].present?

That said, as far as I know you won’t get much better boot time for tests, specially on a Mac (if you are using one)

Thanks for the reply!

The eager_load config is there, and yeap, I am using a Mac. Now I might want to try and run it on a Linux machine.

Is the slowness with all Macs, or only Intel or Mac Silicon? I experience the same issue with slow boot/test times with my quad-core 2017 intel i7 Mac. I’m curious if this is solved with the newer M1 or M2?

The problem is a Mac thing, not a processor thing. Sam Saffron tested it. Mac worse than windows too. Only linux has good performance.

Why I stuck with Windows for 6 years while developing Discourse.

1 Like

The last comments in this thread offer some hope about M1/M2 but I’ve thrown in a question if anyone has feedback about it.

1 Like

M1/2 boot time is very good, we see 1.5 seconds for Discourse, not many systems will even match that yet alone beat it


Maybe with spring GitHub - rails/spring: Rails application preloader