Several points:
* Some of your test cases seem to be parsing from or serializing to files. This may be measuring file I/O performance more than it is measuring the respective serialization libraries. Even though you are using clock() to measure time, simply setting up file I/O operations involves syscalls and copying that could take some CPU time to execute. Try parsing from and serializing to in-memory buffers instead. For protocol buffers you should use ParseFromArray() and SerializeToArray() for maximum performance -- not sure if boost has equivalents.
* Your test generates different random data for the boost test vs. the protobuf test. For an accurate comparison, you really should use identical data.
* Finally, your test isn't a very interesting test case for protocol buffers. Parsing and serializing a lot of strings is going to be dominated by the performance of memcpy(). You might notice that the actual serialization step in your program takes much less time than even just populating the message object. It might be more interesting to try serializing a message involving many different fields of different types.
I think the reason parsing ends up being much slower than serialization for you is because it spends most of the time in malloc(), allocating strings. There are a few things you can do about this:
1) Reuse the same message object every time you parse. It will then reuse the same memory instead of allocating new memory.
2) Make sure you are not using a reference-counting string implementation. They are, ironically, very slow, due to the need for atomic operations.
3) Use Google's tcmalloc in place of your system's malloc. It is probably a lot faster.