Speed up blob presenter specs
What does this MR do and why?
This MR improves the runtime of blob presenter spec by not creating unnecessary project factory.
This spec can be run in random order.
Contributes to #407877
Contributes to &8745.
RSpec Profiling
Here's the output from test-prof
when run with FPROF=1
. Note:
-
Total amount
of factories created went down from 21 to 1🚀 -
Total events
went down from 2035 to 44 - Queries saved: 1991
Before
Finished in 20.91 seconds (files took 6.71 seconds to load)
20 examples, 0 failures
Randomized with seed 27353
[TEST PROF INFO] Time spent in factories: 00:12.830 (59.35% of total time)
[TEST PROF INFO] Factories usage
Total: 41
Total top-level: 21
Total time: 00:12.830 (out of 00:25.743)
Total uniq factories: 3
total top-level total time time per call top-level time name
20 20 12.8155s 0.6408s 12.8155s project
20 0 3.1037s 0.1552s 0.0000s namespace
1 1 0.0146s 0.0146s 0.0146s license
After
Finished in 8.48 seconds (files took 6.27 seconds to load)
20 examples, 0 failures
Randomized with seed 50348
[TEST PROF INFO] Time spent in factories: 00:00.016 (0.18% of total time)
[TEST PROF INFO] Factories usage
Total: 1
Total top-level: 1
Total time: 00:00.016 (out of 00:12.945)
Total uniq factories: 1
total top-level total time time per call top-level time name
1 1 0.0164s 0.0164s 0.0164s license
How to set up and validate locally
bin/rspec ./spec/presenters/blobs/unfold_presenter_spec.rb
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen