mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
PERF: Avoid calling the same translation twice when rendering lists view (#22976)
Why this change? In production, this appeared as a small hotspot as where we're calling `poster.name_and_description` twice which in turns makes a method call to `I18n.t`. When we're rendering a topic list with many topics and each topic has many posters, this repeated and unnecessary method call quickly adds up.
This commit is contained in:
parent
1f7e5e8e75
commit
5d1a9a44c6
@ -88,7 +88,8 @@
|
||||
<td class='posters'>
|
||||
<% t.posters.each do |poster| %>
|
||||
<a href="<%= Discourse.base_url %>/u/<%= poster.user.username %>" class="<%= poster.extras %>">
|
||||
<img width="25" height="25" src="<%= poster.user.avatar_template.gsub('{size}', '25') %>" class="avatar" title='<%= h(poster.name_and_description) %>' aria-label='<%= h(poster.name_and_description) %>'>
|
||||
<%- poster_name_and_description = h(poster.name_and_description) %>
|
||||
<img width="25" height="25" src="<%= poster.user.avatar_template.gsub('{size}', '25') %>" class="avatar" title='<%= poster_name_and_description %>' aria-label='<%= poster_name_and_description %>'>
|
||||
</a>
|
||||
<% end %>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user