Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
3fdd76bd
Commit
3fdd76bd
authored
Jun 03, 2016
by
Ismael
Committed by
Dominic Hamon
Jun 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue 235 (#236)
parent
2d088a9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
complexity.cc
src/complexity.cc
+2
-2
complexity_test.cc
test/complexity_test.cc
+2
-1
No files found.
src/complexity.cc
View file @
3fdd76bd
...
@@ -35,9 +35,9 @@ BigOFunc* FittingCurve(BigO complexity) {
...
@@ -35,9 +35,9 @@ BigOFunc* FittingCurve(BigO complexity) {
case
oNCubed
:
case
oNCubed
:
return
[](
int
n
)
->
double
{
return
n
*
n
*
n
;
};
return
[](
int
n
)
->
double
{
return
n
*
n
*
n
;
};
case
oLogN
:
case
oLogN
:
return
[](
int
n
)
{
return
log2
(
n
);
};
return
[](
int
n
)
{
return
std
::
log2
(
n
);
};
case
oNLogN
:
case
oNLogN
:
return
[](
int
n
)
{
return
n
*
log2
(
n
);
};
return
[](
int
n
)
{
return
n
*
std
::
log2
(
n
);
};
case
o1
:
case
o1
:
default
:
default
:
return
[](
int
)
{
return
1.0
;
};
return
[](
int
)
{
return
1.0
;
};
...
...
test/complexity_test.cc
View file @
3fdd76bd
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <vector>
#include <vector>
#include <utility>
#include <utility>
#include <algorithm>
#include <algorithm>
#include <cmath>
namespace
{
namespace
{
...
@@ -220,7 +221,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) {
...
@@ -220,7 +221,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) {
state
.
SetComplexityN
(
state
.
range_x
());
state
.
SetComplexityN
(
state
.
range_x
());
}
}
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
oNLogN
);
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
oNLogN
);
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
([](
int
n
)
{
return
n
*
log2
(
n
);
});
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
([](
int
n
)
{
return
n
*
std
::
log2
(
n
);
});
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
();
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
();
const
char
*
big_o_n_lg_n_test_name
=
"BM_Complexity_O_N_log_N_BigO"
;
const
char
*
big_o_n_lg_n_test_name
=
"BM_Complexity_O_N_log_N_BigO"
;
...
...
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