Skip to content
Snippets Groups Projects
Commit afdc0285 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Speed up searching for text references a bit

If a node is ignored there's no need for searching for a given pattern.
In turn, when searching for the pattern there's no need to construct a
MatchData object as we only care about presence (or lack thereof), not
the resulting matches.

In terms of performance this cuts down about 200 ms when loading
issue #2164 locally, though this varies a bit depending on system load.
parent 97eafd4b
No related branches found
No related tags found
1 merge request!1648Speed up searching for text references a bit
Please view this file on the master branch, on stable branches it's out of date.
 
v 8.2.0 (unreleased)
- Improved performance of replacing references in comments
- Fix duplicate repositories in GitHub import page (Stan Hu)
- Show last project commit to default branch on project home page
- Highlight comment based on anchor in URL
Loading
Loading
Loading
Loading
@@ -107,10 +107,10 @@ module Gitlab
return doc if project.nil?
 
search_text_nodes(doc).each do |node|
content = node.to_html
next unless content.match(pattern)
next if ignored_ancestry?(node)
next unless node.text =~ pattern
content = node.to_html
 
html = yield content
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment