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
4ea8218c
Commit
4ea8218c
authored
Jan 21, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matching benchmark
parent
ec6b9096
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
171 additions
and
2 deletions
+171
-2
.gitignore
.gitignore
+1
-0
benchmarks/Makefile.am
benchmarks/Makefile.am
+3
-2
benchmarks/Matching.scala
benchmarks/Matching.scala
+55
-0
benchmarks/matching.cpp
benchmarks/matching.cpp
+110
-0
cppa.files
cppa.files
+2
-0
No files found.
.gitignore
View file @
4ea8218c
...
@@ -16,6 +16,7 @@ test
...
@@ -16,6 +16,7 @@ test
benchmarks/mailbox_performance
benchmarks/mailbox_performance
benchmarks/actor_creation
benchmarks/actor_creation
benchmarks/mixed_case
benchmarks/mixed_case
benchmarks/matching
theron_mailbox_performance
theron_mailbox_performance
.libs/
.libs/
.deps/
.deps/
...
...
benchmarks/Makefile.am
View file @
4ea8218c
...
@@ -3,15 +3,16 @@ ACLOCAL_AMFLAGS = -I ../m4
...
@@ -3,15 +3,16 @@ ACLOCAL_AMFLAGS = -I ../m4
AM_CXXFLAGS
=
-I
../
--std
=
c++0x
-pedantic
-Wall
-Wextra
AM_CXXFLAGS
=
-I
../
--std
=
c++0x
-pedantic
-Wall
-Wextra
noinst_PROGRAMS
=
actor_creation mailbox_performance mixed_case
noinst_PROGRAMS
=
actor_creation mailbox_performance mixed_case
matching
actor_creation_SOURCES
=
actor_creation.cpp
actor_creation_SOURCES
=
actor_creation.cpp
mailbox_performance_SOURCES
=
mailbox_performance.cpp
mailbox_performance_SOURCES
=
mailbox_performance.cpp
mixed_case_SOURCES
=
mixed_case.cpp
mixed_case_SOURCES
=
mixed_case.cpp
matching_SOURCES
=
matching.cpp
EXAMPLES_LIBS
=
-L
../.libs/
-lcppa
$(BOOST_LDFLAGS)
$(BOOST_THREAD_LIB)
EXAMPLES_LIBS
=
-L
../.libs/
-lcppa
$(BOOST_LDFLAGS)
$(BOOST_THREAD_LIB)
actor_creation_LDADD
=
$(EXAMPLES_LIBS)
actor_creation_LDADD
=
$(EXAMPLES_LIBS)
mailbox_performance_LDADD
=
$(EXAMPLES_LIBS)
mailbox_performance_LDADD
=
$(EXAMPLES_LIBS)
mixed_case_LDADD
=
$(EXAMPLES_LIBS)
mixed_case_LDADD
=
$(EXAMPLES_LIBS)
matching_LDADD
=
$(EXAMPLES_LIBS)
benchmarks/Matching.scala
0 → 100644
View file @
4ea8218c
import
Console.println
import
scala.
{
PartialFunction
=>
PF
}
case
class
Msg1
(
val0
:
Int
)
case
class
Msg2
(
val0
:
Double
)
case
class
Msg3
(
val0
:
List
[
Int
])
case
class
Msg4
(
val0
:
Int
,
val1
:
String
)
case
class
Msg5
(
val0
:
Int
,
val1
:
Int
,
val2
:
Int
)
case
class
Msg6
(
val0
:
Int
,
val1
:
Double
,
val2
:
String
)
object
Matching
{
def
main
(
args
:
Array
[
String
])
=
{
if
(
args
.
size
!=
1
)
{
println
(
"usage: Matching {NUM_LOOPS}"
)
System
.
exit
(
1
)
}
val
zero
:
Long
=
0
val
numLoops
=
args
(
0
).
toLong
var
msg1Matched
:
Long
=
0
;
var
msg2Matched
:
Long
=
0
;
var
msg3Matched
:
Long
=
0
;
var
msg4Matched
:
Long
=
0
;
var
msg5Matched
:
Long
=
0
;
var
msg6Matched
:
Long
=
0
;
val
partFun
:
PF
[
Any
,
Unit
]
=
{
case
Msg1
(
_
)
=>
msg1Matched
+=
1
case
Msg2
(
_
)
=>
msg2Matched
+=
1
case
Msg3
(
_
)
=>
msg3Matched
+=
1
case
Msg4
(
_
,
_
)
=>
msg4Matched
+=
1
case
Msg5
(
_
,
_
,
_
)
=>
msg5Matched
+=
1
case
Msg6
(
_
,
_
,
_
)
=>
msg6Matched
+=
1
}
val
m1
=
Msg1
(
0
)
val
m2
=
Msg2
(
0.0
)
val
m3
=
Msg3
(
List
(
0
))
val
m4
=
Msg4
(
0
,
"0"
)
val
m5
=
Msg5
(
0
,
0
,
0
)
val
m6
=
Msg6
(
0
,
0.0
,
"0"
)
for
(
_
<-
zero
until
numLoops
)
{
partFun
(
m1
)
partFun
(
m2
)
partFun
(
m3
)
partFun
(
m4
)
partFun
(
m5
)
partFun
(
m6
)
}
assert
(
msg1Matched
==
numLoops
)
assert
(
msg2Matched
==
numLoops
)
assert
(
msg3Matched
==
numLoops
)
assert
(
msg4Matched
==
numLoops
)
assert
(
msg5Matched
==
numLoops
)
assert
(
msg6Matched
==
numLoops
)
println
(
"msg1Matched = "
+
msg1Matched
.
toString
)
}
}
benchmarks/matching.cpp
0 → 100644
View file @
4ea8218c
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#include <list>
#include <string>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <iostream>
#include "cppa/on.hpp"
#include "cppa/atom.hpp"
#include "cppa/match.hpp"
#include "cppa/tuple.hpp"
#include "cppa/announce.hpp"
using
std
::
cout
;
using
std
::
cerr
;
using
std
::
endl
;
using
std
::
list
;
using
std
::
string
;
using
std
::
int64_t
;
using
namespace
cppa
;
template
<
typename
T
>
T
rd
(
char
const
*
cstr
)
{
char
*
endptr
=
nullptr
;
T
result
=
static_cast
<
T
>
(
strtol
(
cstr
,
&
endptr
,
10
));
if
(
endptr
==
nullptr
||
*
endptr
!=
'\0'
)
{
std
::
string
errstr
;
errstr
+=
"
\"
"
;
errstr
+=
cstr
;
errstr
+=
"
\"
is not an integer"
;
throw
std
::
invalid_argument
(
errstr
);
}
return
result
;
}
int
main
(
int
argc
,
char
**
argv
)
{
announce
<
list
<
int
>>
();
if
(
argc
!=
2
)
{
cerr
<<
"usage: matching {NUM_LOOPS}"
<<
endl
;
return
1
;
}
auto
num_loops
=
rd
<
int64_t
>
(
argv
[
1
]);
any_tuple
m1
=
make_tuple
(
atom
(
"msg1"
),
0
);
any_tuple
m2
=
make_tuple
(
atom
(
"msg2"
),
0.0
);
any_tuple
m3
=
cppa
::
make_tuple
(
atom
(
"msg3"
),
list
<
int
>
{
0
});
any_tuple
m4
=
make_tuple
(
atom
(
"msg4"
),
0
,
"0"
);
any_tuple
m5
=
make_tuple
(
atom
(
"msg5"
),
0
,
0
,
0
);
any_tuple
m6
=
make_tuple
(
atom
(
"msg6"
),
0
,
0.0
,
"0"
);
int64_t
m1matched
=
0
;
int64_t
m2matched
=
0
;
int64_t
m3matched
=
0
;
int64_t
m4matched
=
0
;
int64_t
m5matched
=
0
;
int64_t
m6matched
=
0
;
auto
part_fun
=
(
on
<
atom
(
"msg1"
),
int
>
()
>>
[
&
]()
{
++
m1matched
;
},
on
<
atom
(
"msg2"
),
double
>
()
>>
[
&
]()
{
++
m2matched
;
},
on
<
atom
(
"msg3"
),
list
<
int
>
>
()
>>
[
&
]()
{
++
m3matched
;
},
on
<
atom
(
"msg4"
),
int
,
string
>
()
>>
[
&
]()
{
++
m4matched
;
},
on
<
atom
(
"msg5"
),
int
,
int
,
int
>
()
>>
[
&
]()
{
++
m5matched
;
},
on
<
atom
(
"msg6"
),
int
,
double
,
string
>
()
>>
[
&
]()
{
++
m6matched
;
}
);
for
(
int64_t
i
=
0
;
i
<
num_loops
;
++
i
)
{
part_fun
(
m1
);
part_fun
(
m2
);
part_fun
(
m3
);
part_fun
(
m4
);
part_fun
(
m5
);
part_fun
(
m6
);
}
}
cppa.files
View file @
4ea8218c
...
@@ -252,3 +252,5 @@ cppa/util/is_manipulator.hpp
...
@@ -252,3 +252,5 @@ cppa/util/is_manipulator.hpp
cppa/util/apply_tuple.hpp
cppa/util/apply_tuple.hpp
cppa/any_tuple_view.hpp
cppa/any_tuple_view.hpp
cppa/match.hpp
cppa/match.hpp
benchmarks/Matching.scala
benchmarks/matching.cpp
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