Execute specific named route method from toggle_award_url helper method
What does this MR do?
Use specific named route method because this helper method is called a lot of times in pages with a lot of discussions.
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
Screenshots (if relevant)
require 'benchmark/ips'
project = Project.find_with_namespace("gitlab-org/gitlab-ce")
project.namespace # Association load
namespace = project.namespace.becomes(Namespace)
note = project.notes.last
Benchmark.ips do |x|
x.report("current") do
app.url_for([:toggle_award_emoji, project.namespace.becomes(Namespace), project, note])
end
x.report("inter1") do
app.url_for([:toggle_award_emoji, namespace, project, note])
end
x.report("inter2") do
app.toggle_award_emoji_namespace_project_note_url(namespace, project, note)
end
x.report("new") do
app.toggle_award_emoji_namespace_project_note_url(namespace_id: project.namespace_id, project_id: project.id, id: note.id)
end
x.compare!
end
Calculating -------------------------------------
current 164.000 i/100ms
inter1 358.000 i/100ms
inter2 749.000 i/100ms
new 956.000 i/100ms
-------------------------------------------------
current 1.625k (± 8.1%) i/s - 8.200k
inter1 3.657k (± 6.3%) i/s - 18.258k
inter2 7.784k (± 8.3%) i/s - 38.948k
new 9.821k (± 9.3%) i/s - 48.756k
Comparison:
new: 9821.4 i/s
inter2: 7783.6 i/s - 1.26x slower
inter1: 3656.5 i/s - 2.69x slower
current: 1624.6 i/s - 6.05x slower
Does this MR meet the acceptance criteria?
-
CHANGELOG entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Relates with #23241 (moved) and #23226 (moved)