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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
7adf9a52
Commit
7adf9a52
authored
Oct 06, 2015
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added benchmarks for finding trending projects
parent
b7abba0c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
spec/benchmarks/finders/trending_projects_finder_spec.rb
spec/benchmarks/finders/trending_projects_finder_spec.rb
+14
-0
spec/benchmarks/models/project_spec.rb
spec/benchmarks/models/project_spec.rb
+33
-0
No files found.
spec/benchmarks/finders/trending_projects_finder_spec.rb
0 → 100644
View file @
7adf9a52
require
'spec_helper'
describe
TrendingProjectsFinder
,
benchmark:
true
do
describe
'#execute'
do
let
(
:finder
)
{
described_class
.
new
}
let
(
:user
)
{
create
(
:user
)
}
# to_a is used to force actually running the query (instead of just building
# it).
benchmark_subject
{
finder
.
execute
(
user
).
non_archived
.
to_a
}
it
{
is_expected
.
to
iterate_per_second
(
500
)
}
end
end
spec/benchmarks/models/project_spec.rb
0 → 100644
View file @
7adf9a52
require
'spec_helper'
describe
Project
,
benchmark:
true
do
describe
'.trending'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project1
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
let
(
:project2
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
let
(
:iterations
)
{
500
}
before
do
2
.
times
do
create
(
:note_on_commit
,
project:
project1
)
end
create
(
:note_on_commit
,
project:
project2
)
end
describe
'without an explicit start date'
do
benchmark_subject
{
described_class
.
trending
.
to_a
}
it
{
is_expected
.
to
iterate_per_second
(
iterations
)
}
end
describe
'with an explicit start date'
do
let
(
:date
)
{
1
.
month
.
ago
}
benchmark_subject
{
described_class
.
trending
(
date
).
to_a
}
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