Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-05-11 15:06:44 +0300
committerSean McGivern <sean@gitlab.com>2019-05-14 19:01:48 +0300
commit79dd92c8189600f24a29fe2da8d391cdb021f8fd (patch)
treefff4f45718495005bcacc82156bf7fc05943a568 /spec/controllers
parent513fa60310e5b5d8dbdf81daf0c6ae7e506b4d8b (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/controllers')
-rw-r--r--spec/controllers/concerns/send_file_upload_spec.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/controllers/concerns/send_file_upload_spec.rb b/spec/controllers/concerns/send_file_upload_spec.rb
index 8408578a7db..a3ce08f736c 100644
--- a/spec/controllers/concerns/send_file_upload_spec.rb
+++ b/spec/controllers/concerns/send_file_upload_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
# frozen_string_literal: true
require 'spec_helper'
@@ -13,7 +14,7 @@ describe SendFileUpload do
# 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
end