Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
9ee3fc8a
Commit
9ee3fc8a
authored
Apr 12, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guard 'benchmarking'
parent
3ef2f802
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
6 deletions
+72
-6
unit_testing/test__tuple.cpp
unit_testing/test__tuple.cpp
+72
-6
No files found.
unit_testing/test__tuple.cpp
View file @
9ee3fc8a
...
...
@@ -1366,19 +1366,85 @@ size_t test__tuple()
make_cow_tuple
(
1
,
2
,
3
)
};
cout
<<
"old partial function implementation for 10,000,000 matches"
<<
endl
;
constexpr
size_t
numInvokes
=
100000000
;
auto
xvals
=
make_cow_tuple
(
1
,
2
,
"3"
);
std
::
string
three
{
"3"
};
std
::
atomic
<
std
::
string
*>
p3
{
&
three
};
auto
guard1
=
_x1
==
1
;
auto
guard2
=
_x1
+
_x2
==
3
;
auto
guard3
=
_x1
+
_x2
==
3
&&
_x3
==
"3"
;
int
dummy_counter
=
0
;
cout
<<
"time for for "
<<
numInvokes
<<
" guards(1)*"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
numInvokes
;
++
i
)
if
(
guard1
(
1
,
2
,
*
p3
))
//const_cast<std::string&>(three)))
++
dummy_counter
;
}
cout
<<
"time for for "
<<
numInvokes
<<
" guards(1)*"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
numInvokes
;
++
i
)
if
(
guard1
(
get_ref
<
0
>
(
xvals
),
get_ref
<
1
>
(
xvals
),
get_ref
<
2
>
(
xvals
)))
++
dummy_counter
;
}
cout
<<
"time for for "
<<
numInvokes
<<
" guards(1)"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
numInvokes
;
++
i
)
if
(
util
::
unchecked_apply_tuple
<
bool
>
(
guard1
,
xvals
))
++
dummy_counter
;
}
cout
<<
"time for for "
<<
numInvokes
<<
" guards(2)"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
numInvokes
;
++
i
)
if
(
util
::
unchecked_apply_tuple
<
bool
>
(
guard2
,
xvals
))
++
dummy_counter
;
}
cout
<<
"time for for "
<<
numInvokes
<<
" guards(3)"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
numInvokes
;
++
i
)
if
(
util
::
unchecked_apply_tuple
<
bool
>
(
guard3
,
xvals
))
++
dummy_counter
;
}
cout
<<
"time for "
<<
numInvokes
<<
" equal if-statements"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
(
numInvokes
/
sizeof
(
testee
));
++
i
)
{
if
(
get
<
0
>
(
xvals
)
+
get
<
1
>
(
xvals
)
==
3
&&
get
<
2
>
(
xvals
)
==
"3"
)
{
++
dummy_counter
;
}
}
}
cout
<<
"old partial function implementation for "
<<
numInvokes
<<
" matches"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
(
10000000
/
sizeof
(
testee
));
++
i
)
for
(
size_t
i
=
0
;
i
<
(
numInvokes
/
sizeof
(
testee
));
++
i
)
{
for
(
auto
&
x
:
testee
)
{
old_pf
(
x
);
}
}
}
cout
<<
"new partial function implementation for
1,000,000
matches"
<<
endl
;
cout
<<
"new partial function implementation for
"
<<
numInvokes
<<
"
matches"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
(
10000000
/
sizeof
(
testee
));
++
i
)
for
(
size_t
i
=
0
;
i
<
(
numInvokes
/
sizeof
(
testee
));
++
i
)
{
for
(
auto
&
x
:
testee
)
{
new_pf
.
invoke
(
x
);
}
}
...
...
@@ -1387,7 +1453,7 @@ size_t test__tuple()
cout
<<
"old partial function with on() inside loop"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
(
10000000
/
sizeof
(
testee
));
++
i
)
for
(
size_t
i
=
0
;
i
<
(
numInvokes
/
sizeof
(
testee
));
++
i
)
{
auto
tmp
=
(
...
...
@@ -1403,7 +1469,7 @@ size_t test__tuple()
cout
<<
"new partial function with on() inside loop"
<<
endl
;
{
boost
::
progress_timer
t0
;
for
(
size_t
i
=
0
;
i
<
(
10000000
/
sizeof
(
testee
));
++
i
)
for
(
size_t
i
=
0
;
i
<
(
numInvokes
/
sizeof
(
testee
));
++
i
)
{
auto
tmp
=
(
...
...
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