Skip to content

Use `git update-ref --stdin -z` to speed up TestEnv.set_repo_refs

What does this MR do?

Switches from executing git update-ref ~30 times per create(:project) call to executing it once only.

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

The test suite is slow. This is part of why.

Screenshots (if relevant)

public_access_spec.rb.dump.before public_access_spec.rb.dump.after

gitlab-mbp:gitlab lupine$ stackprof --select-names TestEnv public_access_spec.rb.dump.before
==================================
  Mode: wall(1000)
  Samples: 374178 (6.99% miss rate)
  GC: 55991 (14.96%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
     42353  (11.3%)       13937   (3.7%)     TestEnv#set_repo_refs
        61   (0.0%)           5   (0.0%)     TestEnv#setup_repo
         1   (0.0%)           1   (0.0%)     TestEnv#warm_asset_cache?
         1   (0.0%)           1   (0.0%)     TestEnv#factory_repo_path_bare
      4414   (1.2%)           0   (0.0%)     TestEnv#warm_asset_cache
      3274   (0.9%)           0   (0.0%)     TestEnv#clean_test_path
      1698   (0.5%)           0   (0.0%)     TestEnv#init
        49   (0.0%)           0   (0.0%)     TestEnv#setup_factory_repo
        12   (0.0%)           0   (0.0%)     TestEnv#setup_forked_repo
     15315   (4.1%)           0   (0.0%)     TestEnv#copy_repo
gitlab-mbp:gitlab lupine$ stackprof --select-names TestEnv public_access_spec.rb.dump.after
==================================
  Mode: wall(1000)
  Samples: 385945 (3.33% miss rate)
  GC: 56259 (14.58%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
      2069   (0.5%)         517   (0.1%)     TestEnv#set_repo_refs
         5   (0.0%)           3   (0.0%)     TestEnv#setup_repo
         3   (0.0%)           3   (0.0%)     TestEnv#factory_repo_path
         5   (0.0%)           2   (0.0%)     TestEnv#factory_repo_path_bare
      6431   (1.7%)           0   (0.0%)     TestEnv#warm_asset_cache
        12   (0.0%)           0   (0.0%)     TestEnv#clean_test_path
        12   (0.0%)           0   (0.0%)     TestEnv#init
         3   (0.0%)           0   (0.0%)     TestEnv#setup_factory_repo
         1   (0.0%)           0   (0.0%)     TestEnv#forked_repo_path
         3   (0.0%)           0   (0.0%)     TestEnv#setup_forked_repo
      1991   (0.5%)           0   (0.0%)     TestEnv#copy_repo
gitlab-mbp:gitlab lupine$

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Related to #23034 (closed)

Merge request reports

Loading