On Mar 5, 7:07 am, Jon Skeet <sk...@pobox.com> wrote:

> This is only an initial cut, but I wanted to get it out into the
> community quickly rather than polishing build scripts etc. You
> currently have to build by hand, but there are instructions in the
> readme.

Here are the results of a reasonably faithful port of Jon's Java
benchmark code to C++.  I'll see if I can post the code to the "Files"
section of the Google Group.

Here's the output when run on Jon's test-cases.

Benchmarking benchmarks.SizeMessage1 with file /home/cae/src/protobuf/
benchmarks/google_message1.dat
SerializeAsString: 312076 ops in 5.04s; 61919.8 ops/sec; 16.1499 usec/
op; 13.4637 MiB/s
SerializeToString: 315076 ops in 4.97s; 63395.6 ops/sec; 15.774 usec/
op; 13.7846 MiB/s
SerializeToArray: 318135 ops in 4.97s; 64011.1 ops/sec; 15.6223 usec/
op; 13.9184 MiB/s
ParseFromString: 341333 ops in 4.97s; 68678.7 ops/sec; 14.5606 usec/
op; 14.9333 MiB/s
ParseFromArray: 339564 ops in 4.99s; 68048.9 ops/sec; 14.6953 usec/op;
14.7964 MiB/s

Benchmarking benchmarks.SpeedMessage1 with file /home/cae/src/protobuf/
benchmarks/google_message1.dat
SerializeAsString: 2818752 ops in 5.03s; 560388 ops/sec; 1.78448 usec/
op; 121.85 MiB/s
SerializeToString: 3139449 ops in 5.04s; 622907 ops/sec; 1.60538 usec/
op; 135.443 MiB/s
SerializeToArray: 3615779 ops in 5.02s; 720275 ops/sec; 1.38836 usec/
op; 156.615 MiB/s
ParseFromString: 3066011 ops in 5.02s; 610759 ops/sec; 1.63731 usec/
op; 132.802 MiB/s
ParseFromArray: 3048186 ops in 4.99s; 610859 ops/sec; 1.63704 usec/op;
132.824 MiB/s

Benchmarking benchmarks.SizeMessage2 with file /home/cae/src/protobuf/
benchmarks/google_message2.dat
SerializeAsString: 653 ops in 5.02s; 130.08 ops/sec; 7687.6 usec/op;
10.4912 MiB/s
SerializeToString: 646 ops in 4.95s; 130.505 ops/sec; 7662.54 usec/op;
10.5255 MiB/s
SerializeToArray: 653 ops in 5s; 130.6 ops/sec; 7656.97 usec/op;
10.5332 MiB/s
ParseFromString: 825 ops in 5.01s; 164.671 ops/sec; 6072.73 usec/op;
13.2811 MiB/s
ParseFromArray: 825 ops in 5.02s; 164.343 ops/sec; 6084.85 usec/op;
13.2546 MiB/s

Benchmarking benchmarks.SpeedMessage2 with file /home/cae/src/protobuf/
benchmarks/google_message2.dat
SerializeAsString: 11130 ops in 4.98s; 2234.94 ops/sec; 447.439 usec/
op; 180.253 MiB/s
SerializeToString: 11070 ops in 4.95s; 2236.36 ops/sec; 447.154 usec/
op; 180.368 MiB/s
SerializeToArray: 11505 ops in 4.96s; 2319.56 ops/sec; 431.117 usec/
op; 187.077 MiB/s
ParseFromString: 9225 ops in 4.94s; 1867.41 ops/sec; 535.501 usec/op;
150.611 MiB/s
ParseFromArray: 9309 ops in 4.99s; 1865.53 ops/sec; 536.04 usec/op;
150.459 MiB/s


Here's how I compiled the code:

% g++ -I$HOME/src/boost -O3 -g -o ProtoBench ProtoBench.cpp *.pb.cc -
lprotobuf

And ran it:

% ./ProtoBench benchmarks.SizeMessage1 ~/src/protobuf/benchmarks/
google_message1.dat \
benchmarks.SpeedMessage1  ~/src/protobuf/benchmarks/
google_message1.dat \
benchmarks.SizeMessage2  ~/src/protobuf/benchmarks/google_message2.dat
\
benchmarks.SpeedMessage2 ~/src/protobuf/benchmarks/google_message2.dat
|& tee bench.log

And some info about my machine:

% uname -a
Linux tela 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686
GNU/Linux

% gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/
README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/
usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-
included-gettext --enable-threads=posix --enable-nls --with-gxx-
include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-
clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --
enable-targets=all --enable-checking=release --build=i486-linux-gnu --
host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)

% cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Pentium(R) 4 CPU 3.20GHz
stepping        : 3
cpu MHz         : 3207.265
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
constant_tsc pebs bts pni monitor ds_cpl cid
bogomips        : 6414.53
clflush size    : 64
power management:

[ ... and another core just like the first one ... ]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to