summaryrefslogtreecommitdiff
path: root/spec/uploaders
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-05-11 07:06:44 -0500
committerSean McGivern <sean@gitlab.com>2019-05-14 11:01:48 -0500
commit79dd92c8189600f24a29fe2da8d391cdb021f8fd (patch)
treefff4f45718495005bcacc82156bf7fc05943a568 /spec/uploaders
parent513fa60310e5b5d8dbdf81daf0c6ae7e506b4d8b (diff)
downloadgitlab-ce-79dd92c8189600f24a29fe2da8d391cdb021f8fd.tar.gz
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/uploaders')
-rw-r--r--spec/uploaders/object_storage_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/uploaders/object_storage_spec.rb b/spec/uploaders/object_storage_spec.rb
index a62830c35f1..6bad5d49b1c 100644
--- a/spec/uploaders/object_storage_spec.rb
+++ b/spec/uploaders/object_storage_spec.rb
@@ -12,7 +12,7 @@ class Implementation < GitlabUploader
# user/:id
def dynamic_segment
- File.join(model.class.to_s.underscore, model.id.to_s)
+ File.join(model.class.underscore, model.id.to_s)
end
end