Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
fa60e550
Commit
fa60e550
authored
7 years ago
by
Yilun Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix java benchmark to use parser, fix cpp benchmark new arena to use Reset, format some files
parent
b77aa801
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
18 deletions
+16
-18
Makefile.am
benchmarks/Makefile.am
+0
-0
README.md
benchmarks/README.md
+6
-5
cpp_benchmark.cc
benchmarks/cpp_benchmark.cc
+2
-1
pom.xml
benchmarks/java/pom.xml
+0
-0
ProtoBenchCaliper.java
.../src/main/java/com/google/protobuf/ProtoBenchCaliper.java
+6
-12
py_benchmark.py
benchmarks/py_benchmark.py
+2
-0
No files found.
benchmarks/Makefile.am
View file @
fa60e550
This diff is collapsed.
Click to expand it.
benchmarks/README.md
View file @
fa60e550
...
@@ -38,14 +38,15 @@ And you also need to make sure `pkg-config` is installed.
...
@@ -38,14 +38,15 @@ And you also need to make sure `pkg-config` is installed.
### Big data
### Big data
There's some optional big testing data which is not included in the directory
initially, you need to
There's some optional big testing data which is not included in the directory
run the following command to download the testing data:
initially, you need to
run the following command to download the testing data:
```
```
$ ./download_data.sh
$ ./download_data.sh
```
```
After doing this the big data file will automaticly generated in the benchmark directory.
After doing this the big data file will automaticly generated in the
benchmark directory.
## Run instructions
## Run instructions
...
@@ -65,8 +66,8 @@ $ make cpp
...
@@ -65,8 +66,8 @@ $ make cpp
### Python:
### Python:
We have three versions of python protobuf implementation: pure python, cpp
reflection and
We have three versions of python protobuf implementation: pure python, cpp
cpp generated code. To run these version benchmark, you need to:
reflection and
cpp generated code. To run these version benchmark, you need to:
#### Pure Python:
#### Pure Python:
...
...
This diff is collapsed.
Click to expand it.
benchmarks/cpp_benchmark.cc
View file @
fa60e550
...
@@ -121,9 +121,10 @@ class ParseNewArenaFixture : public Fixture {
...
@@ -121,9 +121,10 @@ class ParseNewArenaFixture : public Fixture {
virtual
void
BenchmarkCase
(
benchmark
::
State
&
state
)
{
virtual
void
BenchmarkCase
(
benchmark
::
State
&
state
)
{
WrappingCounter
i
(
payloads_
.
size
());
WrappingCounter
i
(
payloads_
.
size
());
size_t
total
=
0
;
size_t
total
=
0
;
Arena
arena
;
while
(
state
.
KeepRunning
())
{
while
(
state
.
KeepRunning
())
{
Arena
arena
;
arena
.
Reset
()
;
Message
*
m
=
Arena
::
CreateMessage
<
T
>
(
&
arena
);
Message
*
m
=
Arena
::
CreateMessage
<
T
>
(
&
arena
);
const
std
::
string
&
payload
=
payloads_
[
i
.
Next
()];
const
std
::
string
&
payload
=
payloads_
[
i
.
Next
()];
total
+=
payload
.
size
();
total
+=
payload
.
size
();
...
...
This diff is collapsed.
Click to expand it.
benchmarks/java/pom.xml
View file @
fa60e550
This diff is collapsed.
Click to expand it.
benchmarks/java/src/main/java/com/google/protobuf/ProtoBenchCaliper.java
View file @
fa60e550
...
@@ -153,10 +153,8 @@ public class ProtoBenchCaliper {
...
@@ -153,10 +153,8 @@ public class ProtoBenchCaliper {
@Benchmark
@Benchmark
void
deserializeFromByteString
(
int
reps
)
throws
IOException
{
void
deserializeFromByteString
(
int
reps
)
throws
IOException
{
for
(
int
i
=
0
;
i
<
reps
;
i
++)
{
for
(
int
i
=
0
;
i
<
reps
;
i
++)
{
defaultMessage
benchmarkMessageType
.
getDefaultInstance
().
getParserForType
().
parseFrom
(
.
newBuilderForType
()
inputStringList
.
get
((
int
)
(
counter
%
inputStringList
.
size
())),
extensions
);
.
mergeFrom
(
inputStringList
.
get
((
int
)
(
counter
%
inputStringList
.
size
())),
extensions
)
.
build
();
counter
++;
counter
++;
}
}
}
}
...
@@ -164,10 +162,8 @@ public class ProtoBenchCaliper {
...
@@ -164,10 +162,8 @@ public class ProtoBenchCaliper {
@Benchmark
@Benchmark
void
deserializeFromByteArray
(
int
reps
)
throws
IOException
{
void
deserializeFromByteArray
(
int
reps
)
throws
IOException
{
for
(
int
i
=
0
;
i
<
reps
;
i
++)
{
for
(
int
i
=
0
;
i
<
reps
;
i
++)
{
defaultMessage
benchmarkMessageType
.
getDefaultInstance
().
getParserForType
().
parseFrom
(
.
newBuilderForType
()
inputDataList
.
get
((
int
)
(
counter
%
inputDataList
.
size
())),
extensions
);
.
mergeFrom
(
inputDataList
.
get
((
int
)
(
counter
%
inputDataList
.
size
())),
extensions
)
.
build
();
counter
++;
counter
++;
}
}
}
}
...
@@ -175,10 +171,8 @@ public class ProtoBenchCaliper {
...
@@ -175,10 +171,8 @@ public class ProtoBenchCaliper {
@Benchmark
@Benchmark
void
deserializeFromMemoryStream
(
int
reps
)
throws
IOException
{
void
deserializeFromMemoryStream
(
int
reps
)
throws
IOException
{
for
(
int
i
=
0
;
i
<
reps
;
i
++)
{
for
(
int
i
=
0
;
i
<
reps
;
i
++)
{
defaultMessage
benchmarkMessageType
.
getDefaultInstance
().
getParserForType
().
parseFrom
(
.
newBuilderForType
()
inputStreamList
.
get
((
int
)
(
counter
%
inputStreamList
.
size
())),
extensions
);
.
mergeFrom
(
inputStreamList
.
get
((
int
)
(
counter
%
inputStreamList
.
size
())),
extensions
)
.
build
();
inputStreamList
.
get
((
int
)
(
counter
%
inputStreamList
.
size
())).
reset
();
inputStreamList
.
get
((
int
)
(
counter
%
inputStreamList
.
size
())).
reset
();
counter
++;
counter
++;
}
}
...
...
This diff is collapsed.
Click to expand it.
benchmarks/py_benchmark.py
View file @
fa60e550
...
@@ -4,6 +4,7 @@ import timeit
...
@@ -4,6 +4,7 @@ import timeit
import
math
import
math
import
fnmatch
import
fnmatch
# BEGIN CPP GENERATED MESSAGE
# CPP generated code must be linked before importing the generated Python code
# CPP generated code must be linked before importing the generated Python code
# for the descriptor can be found in the pool
# for the descriptor can be found in the pool
if
len
(
sys
.
argv
)
<
2
:
if
len
(
sys
.
argv
)
<
2
:
...
@@ -14,6 +15,7 @@ if sys.argv[1] == "true":
...
@@ -14,6 +15,7 @@ if sys.argv[1] == "true":
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)
)
)
+
"/tmp"
)
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)
)
)
+
"/tmp"
)
elif
sys
.
argv
[
1
]
!=
"false"
:
elif
sys
.
argv
[
1
]
!=
"false"
:
raise
IOError
(
"Need string argument
\"
true
\"
or
\"
false
\"
for whether to use cpp generated code"
)
raise
IOError
(
"Need string argument
\"
true
\"
or
\"
false
\"
for whether to use cpp generated code"
)
# END CPP GENERATED MESSAGE
import
datasets.google_message1.benchmark_message1_proto2_pb2
as
benchmark_message1_proto2_pb2
import
datasets.google_message1.benchmark_message1_proto2_pb2
as
benchmark_message1_proto2_pb2
import
datasets.google_message1.benchmark_message1_proto3_pb2
as
benchmark_message1_proto3_pb2
import
datasets.google_message1.benchmark_message1_proto3_pb2
as
benchmark_message1_proto3_pb2
...
...
This diff is collapsed.
Click to expand it.
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