Hi Team,
I was looking forward to contributing to the Discourse project, and I noticed that your RSpec tests load in 0s!
Are there any tips on how to reduce that time, please? In a project of mine, it’s around 30s !
In a discussion titled “Rspec load time is zero?!” under the Dev category, Hanaffi noticed that Discourse’s RSpec tests appear to load in 0s and asked for tips to reduce load time in their own Rails project, which takes ~30s. pfaffman questioned the premise, noting that 0s doesn’t mean faster than zero and that Discourse’s scale differs significantly. Hanaffi clarified they’re seeking to learn from Discourse’s optimizations. david responded that 0s is likely a measurement artifact, not actual performance, and shared key tools Discourse uses: parallel_tests and test-prof’s let_it_be, wrapped in a fab! helper. Hanaffi shared a CI log screenshot showing the 0s output. david explained that parallel_tests likely causes the 0s reading — the main process doesn’t load tests itself but delegates to workers. Hanaffi thanked the team and asked if using Spring in CI is advisable — though no answer is provided in the thread. The conversation centers on performance optimization techniques for RSpec, clarifying measurement quirks and recommending parallelization and memoization tools.
Hi Team,
I was looking forward to contributing to the Discourse project, and I noticed that your RSpec tests load in 0s!
Are there any tips on how to reduce that time, please? In a project of mine, it’s around 30s !
What command did you run? What happened? What did you expect to happen?
You say that the time is zero, but you want it less than zero? The amount of time your project takes has no bearing on how long it takes on Discourse, which is a very large project with thousands of tests.
No, I was looking forward to learn how you made it, please. I want to do the same on my project
>You say that the time is zero, but you want it less than zero?
I have my own project which is taking 30s and I want to reduce that time for my own rails project, so Im using this as a learning opportunity to know how Discourse team reduced their spec files loading to zero.
Where did you see that? To be honest, if something is saying 0.0s, then it’s probably a measurement error ![]()
Some key things we use to improve RSpec performance are:
test-prof/docs/recipes/let_it_be.md at master · test-prof/test-prof · GitHub (we wrap this in a fab! helper in our codebase)
Thanks for your reply.
Here:
https://github.com/discourse/discourse/actions/runs/20852657462/job/59911214814
I think that might be a side-effect of using parallel_tests. The process which is writing the output doesn’t actually load any tests itself. Instead, it spins up multiple worker processes to run the tests.
I see, thanks so much!
Do you think using spring in CI is good idea?