Skip to content

Use 'let_it_be_with_reload' instead of 'let'

路志远请求将use-let-it-be-instead-of-let合并到main-jh

What does this MR do and why?

Related issue: #3049 (closed)

Use let_it_be_with_reload instead of let to optimize the performance of jh/spec/features/dashboard/groups_list_spec.rb.

Reduced the creation of 15 objects, saving 0.4s 🤣

Before

[TEST PROF INFO] Time spent in factories: 00:00.812 (3.49% of total time)
[TEST PROF INFO] Factories usage

 Total: 29
 Total top-level: 13
 Total time: 00:00.812 (out of 00:29.474)
 Total uniq factories: 5

   total   top-level     total time      time per call      top-level time               name

       8           8        0.4746s            0.0593s             0.4746s              group
       8           0        0.0600s            0.0075s             0.0000s namespace_settings
       8           0        0.0192s            0.0024s             0.0000s namespace_ci_cd_settings
       4           4        0.3288s            0.0822s             0.3288s               user
       1           1        0.0087s            0.0087s             0.0087s            license

After

 Total: 14
 Total top-level: 6
 Total time: 00:00.485 (out of 00:30.086)
 Total uniq factories: 5

   total   top-level     total time      time per call      top-level time               name

       4           4        0.2338s            0.0585s             0.2338s              group
       4           0        0.0130s            0.0033s             0.0000s namespace_settings
       4           0        0.0091s            0.0023s             0.0000s namespace_ci_cd_settings
       1           1        0.2436s            0.2436s             0.2436s               user
       1           1        0.0080s            0.0080s             0.0080s            license

Screenshots or screen recordings

No UI changes.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

路志远 编辑于

合并请求报告

加载中