Actions
Feature #42121
openOptimize Version#wiki_page method
Status:
New
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Description
The current implementation of the Version#wiki_page
method evaluates project.wiki
even when wiki_page_title
is blank. This results in an unnecessary SQL query to the `wikis` table, even when such a query is avoidable.
The method can be optimized to only evaluate project.wiki
if wiki_page_title
is present, reducing a redundant SQL query and improving performance.
Current Implementation:
def wiki_page
if project.wiki && !wiki_page_title.blank?
@wiki_page ||= project.wiki.find_page(wiki_page_title)
end
@wiki_page
end
Proposed Change:
def wiki_page
@wiki_page ||= project.wiki&.find_page(wiki_page_title) if wiki_page_title.present?
end
No data to display
Actions