Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
boolinq
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
boolinq
Commits
89254b45
Commit
89254b45
authored
Jun 29, 2019
by
Anton Bukov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prettify benchmark code
parent
d2dff508
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
SpeedTest.cpp
benchmark/SpeedTest.cpp
+14
-14
No files found.
benchmark/SpeedTest.cpp
View file @
89254b45
...
...
@@ -61,10 +61,8 @@ static void BM_CppCode (benchmark::State& state)
while
(
state
.
KeepRunning
()
)
{
double
sum
=
0
;
int
count
=
0
;
for
(
unsigned
i
=
0
;
i
<
vecCpp
.
size
();
i
++
)
{
if
(
vecCpp
[
i
]
%
2
==
1
)
{
for
(
unsigned
i
=
0
;
i
<
vecCpp
.
size
();
i
++
)
{
if
(
vecCpp
[
i
]
%
2
==
1
)
{
sum
+=
vecCpp
[
i
];
count
++
;
}
...
...
@@ -72,9 +70,11 @@ static void BM_CppCode (benchmark::State& state)
double
avgValue
=
sum
/
count
;
double
stdSum
=
0
;
for
(
unsigned
i
=
0
;
i
<
vecCpp
.
size
();
i
++
)
if
(
vecCpp
[
i
]
%
2
==
1
)
stdSum
+=
(
vecCpp
[
i
]
-
avgValue
)
*
(
vecCpp
[
i
]
-
avgValue
);
for
(
unsigned
i
=
0
;
i
<
vecCpp
.
size
();
i
++
)
{
if
(
vecCpp
[
i
]
%
2
==
1
)
{
stdSum
+=
(
vecCpp
[
i
]
-
avgValue
)
*
(
vecCpp
[
i
]
-
avgValue
);
}
}
double
stdValue
=
stdSum
/
count
;
// It's no test, instead it's avoiding skip of calculation through optimization.
...
...
@@ -93,10 +93,8 @@ static void BM_CppIterCode (benchmark::State& state)
while
(
state
.
KeepRunning
()
)
{
double
sum
=
0
;
int
count
=
0
;
for
(
auto
it
=
vecCppIter
.
begin
();
it
!=
vecCppIter
.
end
();
++
it
)
{
if
(
*
it
%
2
==
1
)
{
for
(
auto
it
=
vecCppIter
.
begin
();
it
!=
vecCppIter
.
end
();
++
it
)
{
if
(
*
it
%
2
==
1
)
{
sum
+=
*
it
;
count
++
;
}
...
...
@@ -104,9 +102,11 @@ static void BM_CppIterCode (benchmark::State& state)
double
avgValue
=
sum
/
count
;
double
stdSum
=
0
;
for
(
auto
it
=
vecCppIter
.
begin
();
it
!=
vecCppIter
.
end
();
++
it
)
if
(
*
it
%
2
==
1
)
stdSum
+=
(
*
it
-
avgValue
)
*
(
*
it
-
avgValue
);
for
(
auto
it
=
vecCppIter
.
begin
();
it
!=
vecCppIter
.
end
();
++
it
)
{
if
(
*
it
%
2
==
1
)
{
stdSum
+=
(
*
it
-
avgValue
)
*
(
*
it
-
avgValue
);
}
}
double
stdValue
=
stdSum
/
count
;
// It's no test, instead it's avoiding skip of calculation through optimization.
...
...
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