From 2fc69b1561e1feaa1cbc56d1617f949d13352b97 Mon Sep 17 00:00:00 2001 From: Yilun Chong Date: Fri, 5 Jan 2018 11:20:40 -0800 Subject: Add python benchmark --- benchmarks/README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) (limited to 'benchmarks/README.md') diff --git a/benchmarks/README.md b/benchmarks/README.md index 09c06907..71104d69 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -17,12 +17,25 @@ We are using [google/benchmark](https://github.com/google/benchmark) as the benchmark tool for testing cpp. This will be automaticly made during build the cpp benchmark. -### JAVA +### Java We're using maven to build the java benchmarks, which is the same as to build the Java protobuf. There're no other tools need to install. We're using [google/caliper](https://github.com/google/caliper) as benchmark tool, which can be automaticly included by maven. +### Python +We're using python C++ API for testing the generated +CPP proto version of python protobuf, which is also a prerequisite for Python +protobuf cpp implementation. You need to install the correct version of Python +C++ extension package before run generated CPP proto version of Python +protobuf's benchmark. e.g. under Ubuntu, you need to + +``` +$ sudo apt-get install python-dev +$ sudo apt-get install python3-dev +``` +And you also need to make sure `pkg-config` is installed. + ### Big data There's some optional big testing data which is not included in the directory initially, you need to @@ -38,34 +51,80 @@ After doing this the big data file will automaticly generated in the benchmark d To run all the benchmark dataset: -For java: +### Java: ``` $ make java ``` -For cpp: +### CPP: ``` $ make cpp ``` +### Python: + +We have three versions of python protobuf implementation: pure python, cpp reflection and +cpp generated code. To run these version benchmark, you need to: + +#### Pure Python: + +``` +$ make python-pure-python +``` + +#### CPP reflection: + +``` +$ make python-cpp-reflection +``` + +#### CPP generated code: + +``` +$ make python-cpp-generated-code +``` + To run a specific dataset: -For java: +### Java: ``` $ make java-benchmark $ ./java-benchmark $(specific generated dataset file name) [-- $(caliper option)] ``` -For cpp: +### CPP: ``` $ make cpp-benchmark $ ./cpp-benchmark $(specific generated dataset file name) ``` +### Python: + +#### Pure Python: + +``` +$ make python-pure-python-benchmark +$ ./python-pure-python-benchmark $(specific generated dataset file name) +``` + +#### CPP reflection: + +``` +$ make python-cpp-reflection-benchmark +$ ./python-cpp-reflection-benchmark $(specific generated dataset file name) +``` + +#### CPP generated code: + +``` +$ make python-cpp-generated-code-benchmark +$ ./python-cpp-generated-code-benchmark $(specific generated dataset file name) +``` + ## Benchmark datasets Each data set is in the format of benchmarks.proto: -- cgit v1.2.3