diff options
author | Sean McGivern <sean@gitlab.com> | 2019-05-11 15:06:44 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-05-14 19:01:48 +0300 |
commit | 79dd92c8189600f24a29fe2da8d391cdb021f8fd (patch) | |
tree | fff4f45718495005bcacc82156bf7fc05943a568 /spec/factories | |
parent | 513fa60310e5b5d8dbdf81daf0c6ae7e506b4d8b (diff) |
Optimise upload path calls
String#underscore isn't particularly slow, but it's possible for us to
call it many times in a users autocomplete request, with mostly-static
values ('User', 'Group', etc.). We can memoise this and save a
surprising amount of time (around 10% of the total request time in some
cases).
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/uploads.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb index 7256f785e1f..426abdc2a6c 100644 --- a/spec/factories/uploads.rb +++ b/spec/factories/uploads.rb @@ -13,7 +13,7 @@ FactoryBot.define do end # this needs to comply with RecordsUpload::Concern#upload_path - path { File.join("uploads/-/system", model.class.to_s.underscore, mount_point.to_s, 'avatar.jpg') } + path { File.join("uploads/-/system", model.class.underscore, mount_point.to_s, 'avatar.jpg') } trait :personal_snippet_upload do uploader "PersonalFileUploader" |