Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e1c3077e
Commit
e1c3077e
authored
Oct 20, 2015
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added benchmark for ReferenceFilter
parent
afdc0285
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb
spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb
+41
-0
No files found.
spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb
0 → 100644
View file @
e1c3077e
require
'spec_helper'
describe
Gitlab
::
Markdown
::
ReferenceFilter
,
benchmark:
true
do
let
(
:input
)
do
html
=
<<-
EOF
<p>Hello @alice and @bob, how are you doing today?</p>
<p>This is simple @dummy text to see how the @ReferenceFilter class performs
when @processing HTML.</p>
EOF
Nokogiri
::
HTML
.
fragment
(
html
)
end
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:filter
)
{
described_class
.
new
(
input
,
project:
project
)
}
describe
'#replace_text_nodes_matching'
do
let
(
:iterations
)
{
6000
}
describe
'with identical input and output HTML'
do
benchmark_subject
do
filter
.
replace_text_nodes_matching
(
User
.
reference_pattern
)
do
|
content
|
content
end
end
it
{
is_expected
.
to
iterate_per_second
(
iterations
)
}
end
describe
'with different input and output HTML'
do
benchmark_subject
do
filter
.
replace_text_nodes_matching
(
User
.
reference_pattern
)
do
|
content
|
'@eve'
end
end
it
{
is_expected
.
to
iterate_per_second
(
iterations
)
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment